Skip to content

feat(swift): add Swift language parser - #198

Merged
gadievron merged 1 commit into
masterfrom
swift-parser-fixed
Jul 30, 2026
Merged

feat(swift): add Swift language parser#198
gadievron merged 1 commit into
masterfrom
swift-parser-fixed

Conversation

@gadievron

@gadievron gadievron commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Swift language parser to OpenAnt, integrated via the config/languages.json
registry introduced in #199. A single registry entry (subprocess mode) provides
parser dispatch, the --language swift CLI choice, the markdown fence, Go flag
help, and language detection — no per-language dispatch edits.

What's included

  • Swift parser (libs/openant-core/parsers/swift/): tree-sitter-based repository
    scan, 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-swift dependency.
  • Registry entry (config/languages.json): swift → subprocess parser
    parsers/swift/test_pipeline.py, .swift extension, swift fence, Xcode
    build-dir skip entries.
  • Entry-point detection (entry_point_detector.py): Swift @objc / @IBAction
    roots and XPC / CLI / stdin input surfaces (CommandLine.arguments,
    NSXPCListener, readLine, NWListener, …) — additive, Swift-syntax-scoped.
  • Context extension (context_corrector.py): .swift added to source gathering.
  • Reachability prune telemetry: an additive, null-safe per-unit prune-telemetry
    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).
  • Swift test suite (tests/parsers/swift/, 101 tests) + docs updated for the
    supported-language enumerations.

Testing

  • Full Python suite green; full Go suite green.
  • Swift parses end-to-end through the registry dispatch (produces units, prunes
    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 whole
reachable subtree — would be dropped from analysis. Swift emits forward-slash
relative paths for cross-platform unit-ID stability.

@gadievron gadievron changed the title Add Swift language parser feat(swift): add Swift language parser Jul 30, 2026
@gadievron
gadievron force-pushed the swift-parser-fixed branch 2 times, most recently from a2abdd0 to 4d918b6 Compare July 30, 2026 08:38
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
gadievron force-pushed the swift-parser-fixed branch from 4d918b6 to a4401ee Compare July 30, 2026 08:44
@gadievron
gadievron merged commit 2ed78f6 into master Jul 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant