Add tree-sitter-swift extractor scaffolding and YEAST desugaring#21812
Open
asgerf wants to merge 7 commits intogithub:mainfrom
Open
Add tree-sitter-swift extractor scaffolding and YEAST desugaring#21812asgerf wants to merge 7 commits intogithub:mainfrom
asgerf wants to merge 7 commits intogithub:mainfrom
Conversation
|
|
||
| /** Holds if this location starts strictly before the specified location. */ | ||
| pragma[inline] | ||
| predicate strictlyBefore(Location other) { |
Contributor
Author
Rerun has been triggered: 1 restarted 🚀 |
5011bfc to
2802819
Compare
Contributor
Author
|
Rerun has been triggered, but no failed runs found |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial “unified” tree-sitter-based extractor scaffold (currently targeting Swift via tree-sitter-swift), wires in a simple YEAST desugaring pass, and adds a small CodeQL library-test to confirm the desugaring is applied during extraction.
Changes:
- Add a new Rust-based
unifiedextractor binary withextract,generate, andautobuildsubcommands. - Add packaging/build integration (Bazel + Cargo workspace) and helper scripts for local pack generation and qltest indexing.
- Add a basic unified QL pack/test pack and a Swift library-test verifying the desugaring effect.
Show a summary per file
| File | Description |
|---|---|
| unified/tools/qltest.sh | Adds qltest indexing for Swift-related extensions in unified tests. |
| unified/tools/qltest.cmd | Windows equivalent qltest indexing script for unified. |
| unified/tools/index-files.sh | Hooks CodeQL “index-files” into the unified extractor’s extract subcommand. |
| unified/tools/index-files.cmd | Windows equivalent for unified index-files. |
| unified/tools/BUILD.bazel | Packages unified tool scripts into the extractor pack. |
| unified/tools/autobuild.sh | Runs unified extractor autobuild. |
| unified/tools/autobuild.cmd | Windows equivalent for unified autobuild. |
| unified/scripts/create-extractor-pack.sh | Local script to build and assemble an extractor pack for testing. |
| unified/ql/test/qlpack.yml | Defines the unified test pack and its workspace dependencies. |
| unified/ql/test/qlpack.lock.yml | Lockfile for unified test pack. |
| unified/ql/test/library-tests/BasicTest/test.swift | Swift input used by the library-test. |
| unified/ql/test/library-tests/BasicTest/test.ql | Library-test query predicates validating AST/desugaring behavior. |
| unified/ql/test/library-tests/BasicTest/test.expected | Expected results validating the desugaring effect. |
| unified/ql/src/qlpack.yml | Defines the unified queries pack. |
| unified/ql/src/qlpack.lock.yml | Lockfile for unified queries pack. |
| unified/ql/lib/unified.dbscheme.stats | Initial dbscheme stats file for unified. |
| unified/ql/lib/qlpack.yml | Defines the unified library pack and dbscheme wiring. |
| unified/ql/lib/qlpack.lock.yml | Lockfile for unified library pack. |
| unified/ql/lib/codeql/unified/Ast.qll | Generated Swift AST library produced from tree-sitter node types. |
| unified/ql/lib/codeql/Locations.qll | Adds a minimal locations helper library for unified QL. |
| unified/ql/lib/codeql/files/FileSystem.qll | Adds minimal file system abstractions for unified QL. |
| unified/ql/lib/BUILD.bazel | Bazel packaging targets for unified dbscheme artifacts. |
| unified/extractor/src/main.rs | CLI entrypoint wiring extract/generate/autobuild. |
| unified/extractor/src/languages/swift/swift.rs | Swift language spec, including a YEAST desugaring phase. |
| unified/extractor/src/generator.rs | Generates dbscheme/QL library for the Swift grammar. |
| unified/extractor/src/extractor.rs | Unified extractor implementation using the shared tree-sitter extractor framework. |
| unified/extractor/src/autobuilder.rs | Unified autobuilder wrapper around shared autobuilder support. |
| unified/extractor/Cargo.toml | New crate definition and dependencies for unified extractor. |
| unified/extractor/BUILD.bazel | Bazel build rule for the unified Rust extractor binary. |
| unified/codeql-extractor.yml | Declares the new unified extractor metadata and file types. |
| unified/BUILD.bazel | Bazel packaging rule to assemble the unified extractor pack. |
| unified/AGENTS.md | Contributor instructions for building/testing the unified extractor. |
| unified/.gitignore | Ignores local build/test outputs for unified. |
| MODULE.bazel | Adds tree-sitter-swift vendored repo to Bazel module deps. |
| misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl | Adds unified extractor crate dependency mapping and swift crate repo. |
| misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.tree-sitter-swift-0.7.2.bazel | Generated Bazel BUILD for tree-sitter-swift crate. |
| misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel | Adds aliases for the tree-sitter-swift crate. |
| Cargo.toml | Adds unified/extractor to the workspace members. |
| Cargo.lock | Adds lock entries for codeql-extractor-unified and tree-sitter-swift. |
Copilot's findings
- Files reviewed: 37/40 changed files
- Comments generated: 6
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
tree-sitter-swift.The extractor is placed in a folder called
unifiedbecause the intent is to have more languages in there eventually.Some follow-up work I have not included in the PR but working on: