feat: add Objective-C language support#165
Open
0x1306a94 wants to merge 1 commit into
Open
Conversation
74ca84e to
ed563b2
Compare
Wire tree-sitter-objc for .m/.mm/ObjC headers: classes, protocols, methods, @Property, #import edges, inheritance, and message-send calls.
ed563b2 to
b45ff3e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds partial Objective-C support to the tree-sitter extraction pipeline so iOS/macOS codebases can be indexed with the same graph queries as other languages.
Wiring
objcinLANGUAGES,WASM_GRAMMAR_FILES(tree-sitter-objc.wasmfromtree-sitter-wasms, ABI 14), andEXTRACTORS.m/.mm→objc; classify.has Objective-C when content matches@interface/@implementation/@protocol/@synthesize(after the existing C++.hheuristic)isSourceFile+.gitignore— no separateincludeglobs neededExtraction (
objc.ts)@interfaceemits one class node;@implementationreuses it viavisitNode(avoids duplicate class/method nodes)@protocol→protocolnodesmethod_definitiononly; full multi-part selectors (doThing:with:) viaresolveName@propertyviaextractPropertyName(walksstruct_declarator/pointer_declarator)function_definitionand#import(preproc_include)extendsfor superclass;implementsfor angle-bracket protocols on@interfacecall_expressionand[receiver message](message_expression) call edgesCore hooks
resolveName/extractPropertyNameonLanguageExtractor(used by ObjC; generic fallbacks unchanged)extractInheritanceearly-return branch forclass_interface.h,.m,.mmDocs & eval corpus
.mmObjC++ limits)[Unreleased]entry with known limitationsBenchmark (local dev build)
Known limitations
[[Class alloc] init]) only record the innermost method nameinstantiatesedge for[Class alloc]patterns@protocol Foo <Bar>refinement lists not yet wired toimplementsedges.mmfiles may parse incompletely under the ObjC grammarTest plan
npm run buildnpx vitest run __tests__/extraction.test.ts -t "Objective-C"(7 tests)node scripts/add-lang/verify-extraction.mjson sample + Masonry / FMDB / SDWebImage