Repository navigation
feat: expose match pattern aliases as fields - #33
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.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.
Why
Match
aspatterns leave their binding identifier unfielded, while expressionaspatterns expose analiasfield. This implements the match-pattern field request intree-sitter/tree-sitter-python#312without changing accepted syntax or node nesting.Requirements
Customer Summary
Consumers can retrieve the binding of
case pattern as namethrough thealiasfield and standard field queries.Technical Summary
grammar.jslabels the binding identifier in_as_pattern; generated metadata and parse tables carry the field to native and Wasm parsers. The public API regression checks the field, query captures, source ranges, a real incremental rename, and the following statement.Testing
Canonical generation with
bun run build/ci, all 207 native corpus cases throughbun wb test test/unit/corpus.test.ts, the new public API regression, andbun run verifypassed. The regression fails against the prior Wasm artifact because its alias-field query is unsupported. All PR CI checks pass, including fuzz, examples, Wasm and native platform coverage.Notes
Seven existing code-gauge errors remain outside this change: Python2 example
GrammarTests.testFuncdefin both newline variants (159 NCSS), Python3 exampleGrammarTests.testFuncdefin both variants (187 NCSS), the Python3.8 example file (1,200 NCSS) and itstest_funcdef(232 NCSS), and the external scanner dispatch (complexity 175/202 NCSS). Refactoring imported fixtures or the unrelated scanner would expand this metadata change. Forty-six existing warnings remain. The intentional LF/CRLF example duplicates would be suitable for a code-gauge exclusion; no exclusion configuration is added.