Skip to content

Add tree-sitter-swift extractor scaffolding and YEAST desugaring#21812

Merged
asgerf merged 7 commits intogithub:mainfrom
asgerf:asgerf/swift-yeast-1
May 8, 2026
Merged

Add tree-sitter-swift extractor scaffolding and YEAST desugaring#21812
asgerf merged 7 commits intogithub:mainfrom
asgerf:asgerf/swift-yeast-1

Conversation

@asgerf
Copy link
Copy Markdown
Contributor

@asgerf asgerf commented May 7, 2026

  • Adds boilerplate for a tree-sitter based extractor using tree-sitter-swift.
  • Uses YEAST to perform a dummy desugaring.
  • A CodeQL test verifies that the desugaring is happening.
  • Adds AGENTS.md to help with worktrees

The extractor is placed in a folder called unified because the intent is to have more languages in there eventually.

Some follow-up work I have not included in the PR but working on:

  • Corpus-style extractor tests with schema validation
  • Changing the output schema


/** Holds if this location starts strictly before the specified location. */
pragma[inline]
predicate strictlyBefore(Location other) {
@asgerf
Copy link
Copy Markdown
Contributor Author

asgerf commented May 7, 2026

Rerun has been triggered: 1 restarted 🚀

@asgerf asgerf added the no-change-note-required This PR does not need a change note label May 7, 2026
@asgerf asgerf force-pushed the asgerf/swift-yeast-1 branch from 5011bfc to 2802819 Compare May 7, 2026 19:38
@asgerf
Copy link
Copy Markdown
Contributor Author

asgerf commented May 7, 2026

Rerun has been triggered, but no failed runs found ⚠️

@asgerf asgerf marked this pull request as ready for review May 7, 2026 20:18
Copilot AI review requested due to automatic review settings May 7, 2026 20:18
@asgerf asgerf requested review from a team as code owners May 7, 2026 20:18
@asgerf asgerf requested a review from tausbn May 7, 2026 20:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 unified extractor binary with extract, generate, and autobuild subcommands.
  • 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

Comment thread unified/extractor/BUILD.bazel Outdated
Comment thread unified/extractor/src/extractor.rs Outdated
Comment thread unified/extractor/src/extractor.rs Outdated
Comment thread unified/extractor/src/extractor.rs Outdated
Comment thread unified/extractor/src/generator.rs Outdated
Comment thread unified/extractor/src/generator.rs Outdated
asgerf and others added 2 commits May 8, 2026 08:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@asgerf
Copy link
Copy Markdown
Contributor Author

asgerf commented May 8, 2026

Rerun has been triggered: 1 restarted 🚀

Copy link
Copy Markdown
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks plausible to me.

Copy link
Copy Markdown
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. Let's get it in.

Comment thread unified/AGENTS.md
@asgerf asgerf merged commit fdef477 into github:main May 8, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants