feat(parsers): add Swift and Objective-C language support#17
Merged
Conversation
Two new parsers using tree-sitter-language-pack's swift and objc grammars, which are already installed as transitive dependencies so this lands with no new direct deps. Swift (.swift): - top-level functions, classes, structs, enums, protocols, extensions - methods (with parent class/struct/protocol as container) - parameter and return-type capture via `user_type` / `type_identifier` - import declarations captured as graph.dependencies - cyclomatic complexity from if/guard/for/while/switch/do/catch - @main entrypoint detection Known gap: Swift `throw` statements use `control_transfer_statement`, which collides with return/break/continue. Capturing throws requires a Swift-specific walk that filters by `throw_keyword` — deferred with a test that locks in non-crash behavior for now. Objective-C (.m, .mm, .h): - top-level C functions (covers main, helper functions) - @interface / @implementation classes - method signatures from @interface and bodies from @implementation (implementation replaces any earlier stub) - selector-based method naming — `login:password:` preserves both keywords so overloads with different argument labels don't collide - #import / #include captured as dependencies - UIApplicationDelegate lifecycle selectors flagged as untrusted external API (deep-link handlers, launch callbacks) Cross-language plumbing: - extract_call_name gains a fallback path for grammars that don't label the callable (Swift emits call_expression with an unlabelled first child). - _CALL_NAME_TYPES adds simple_identifier and navigation_expression for Swift callables. 19 new tests (Swift parser, ObjC parser, entrypoint detection for both). README's supported-languages and framework-coverage tables get the new rows; the README regression test already caught an earlier pass where I forgot to add them. Follow-up languages on the roadmap: Kotlin and Dart/Flutter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Two new parsers using tree-sitter-language-pack's swift and objc grammars, which are already installed as transitive dependencies so this lands with no new direct deps.
Swift (.swift):
user_type/type_identifierKnown gap: Swift
throwstatements usecontrol_transfer_statement,which collides with return/break/continue. Capturing throws requires a
Swift-specific walk that filters by
throw_keyword— deferred with atest that locks in non-crash behavior for now.
Objective-C (.m, .mm, .h):
login:password:preserves both keywords so overloads with different argument labels don't collideCross-language plumbing: