feat(swift): add Swift language parser - #198
Merged
Merged
Conversation
gadievron
requested review from
dgeyshis,
shahar-davidson and
sounil
as code owners
July 30, 2026 05:47
gadievron
force-pushed
the
swift-parser-fixed
branch
2 times, most recently
from
July 30, 2026 08:38
a2abdd0 to
4d918b6
Compare
Adds a tree-sitter-based Swift parser (repository scan, function/type extraction, call-graph construction with overload/trailing-closure/actor resolution, reachability filtering, analysis-unit generation), integrated into the post-#199 registry architecture: a single config/languages.json entry provides dispatch, CLI --language choice, markdown fence, Go flag help and detection. Adds Swift @objc/@IBAction entry-point + XPC/CLI input detection, the .swift context-corrector extension, the tree-sitter-swift dependency, per-unit reachability prune telemetry, and the Swift test suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gadievron
force-pushed
the
swift-parser-fixed
branch
from
July 30, 2026 08:44
4d918b6 to
a4401ee
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 a Swift language parser to OpenAnt, integrated via the
config/languages.jsonregistry introduced in #199. A single registry entry (subprocess mode) provides
parser dispatch, the
--language swiftCLI choice, the markdown fence, Go flaghelp, and language detection — no per-language dispatch edits.
What's included
libs/openant-core/parsers/swift/): tree-sitter-based repositoryscan, function/type extraction, and call-graph construction — overload resolution,
trailing-closure argument labels (SE-0279), actor / protocol / extension handling,
and cross-file method resolution — followed by reachability filtering and
analysis-unit generation. Adds the
tree-sitter-swiftdependency.config/languages.json):swift→ subprocess parserparsers/swift/test_pipeline.py,.swiftextension,swiftfence, Xcodebuild-dir skip entries.
entry_point_detector.py): Swift@objc/@IBActionroots and XPC / CLI / stdin input surfaces (
CommandLine.arguments,NSXPCListener,readLine,NWListener, …) — additive, Swift-syntax-scoped.context_corrector.py):.swiftadded to source gathering.hook in the core reachability filter (does not alter feat: repository-supplied threat models, application-type context, and multi-language scanning #199's blackout behavior).
tests/parsers/swift/, 101 tests) + docs updated for thesupported-language enumerations.
Testing
unreachable code).
Notes
The Swift call graph keeps cross-file calls to user methods whose names shadow
Swift built-ins (e.g.
filter,map); without this the method — and its wholereachable subtree — would be dropped from analysis. Swift emits forward-slash
relative paths for cross-platform unit-ID stability.