3939 '.hbs' , '.handlebars' , '.ejs' , '.pug' ,
4040 # Modern frontend
4141 '.astro' , '.mdx' ,
42+ # Objective-C
43+ '.m' , '.mm' ,
4244 # Database and SQL
4345 '.sql' , '.ddl' , '.dml' , '.mysql' , '.postgresql' , '.psql' , '.sqlite' ,
4446 '.mssql' , '.oracle' , '.ora' , '.db2' ,
@@ -602,6 +604,90 @@ def get_file_summary(file_path: str, ctx: Context) -> Dict[str, Any]:
602604 "enum_count" : len (enums ),
603605 })
604606
607+ elif ext in ['.m' , '.mm' ]:
608+ # Objective-C/Objective-C++ analysis
609+ imports = []
610+ interfaces = []
611+ implementations = []
612+ methods = []
613+ properties = []
614+ protocols = []
615+ categories = []
616+
617+ for i , line in enumerate (lines ):
618+ line = line .strip ()
619+
620+ # Check for imports
621+ if line .startswith ('#import ' ) or line .startswith ('#include ' ):
622+ imports .append (line )
623+
624+ # Check for @interface declarations
625+ if line .startswith ('@interface ' ):
626+ interface_name = line .replace ('@interface ' , '' ).split (':' )[0 ].split ('<' )[0 ].strip ()
627+ interfaces .append ({
628+ "line" : i + 1 ,
629+ "name" : interface_name
630+ })
631+
632+ # Check if it's a category
633+ if '(' in line and ')' in line :
634+ category_name = line [line .find ('(' )+ 1 :line .find (')' )]
635+ categories .append ({
636+ "line" : i + 1 ,
637+ "name" : f"{ interface_name } ({ category_name } )"
638+ })
639+
640+ # Check for @implementation declarations
641+ if line .startswith ('@implementation ' ):
642+ impl_name = line .replace ('@implementation ' , '' ).split (':' )[0 ].split ('<' )[0 ].strip ()
643+ implementations .append ({
644+ "line" : i + 1 ,
645+ "name" : impl_name
646+ })
647+
648+ # Check for @protocol declarations
649+ if line .startswith ('@protocol ' ):
650+ protocol_name = line .replace ('@protocol ' , '' ).split ('<' )[0 ].split (':' )[0 ].strip ()
651+ protocols .append ({
652+ "line" : i + 1 ,
653+ "name" : protocol_name
654+ })
655+
656+ # Check for @property declarations
657+ if line .startswith ('@property ' ):
658+ property_def = line .replace ('@property ' , '' ).split (';' )[0 ].strip ()
659+ properties .append ({
660+ "line" : i + 1 ,
661+ "definition" : property_def
662+ })
663+
664+ # Check for method declarations and definitions
665+ if line .startswith ('- (' ) or line .startswith ('+ (' ):
666+ method_type = "instance" if line .startswith ('- (' ) else "class"
667+ method_content = line .strip ()
668+ methods .append ({
669+ "line" : i + 1 ,
670+ "type" : method_type ,
671+ "signature" : method_content
672+ })
673+
674+ summary .update ({
675+ "imports" : imports ,
676+ "interfaces" : interfaces ,
677+ "implementations" : implementations ,
678+ "methods" : methods ,
679+ "properties" : properties ,
680+ "protocols" : protocols ,
681+ "categories" : categories ,
682+ "import_count" : len (imports ),
683+ "interface_count" : len (interfaces ),
684+ "implementation_count" : len (implementations ),
685+ "method_count" : len (methods ),
686+ "property_count" : len (properties ),
687+ "protocol_count" : len (protocols ),
688+ "category_count" : len (categories ),
689+ })
690+
605691 return summary
606692 except Exception as e :
607693 return {"error" : f"Error analyzing file: { e } " }
@@ -878,4 +964,4 @@ def main():
878964if __name__ == '__main__' :
879965 # Set path to project root
880966 sys .path .append (os .path .dirname (os .path .dirname (os .path .abspath (__file__ ))))
881- main ()
967+ main ()
0 commit comments