Skip to content

feat: expose match pattern aliases as fields - #33

Merged
exKAZUu merged 1 commit into
mainfrom
feat/match-pattern-alias-field
Oct 20, 2026
Merged

exKAZUu merged 1 commit into
mainfrom
feat/match-pattern-alias-field

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Why

Match as patterns leave their binding identifier unfielded, while expression as patterns expose an alias field. This implements the match-pattern field request in tree-sitter/tree-sitter-python#312 without changing accepted syntax or node nesting.

Requirements

  • required: Improve our forked tree-sitter and grammar repositories as much as possible, ignoring backward compatibility; review our issues and major upstream issues, PRs and recent commits and create dedicated nonduplicate PRs from latest main for eligible items.
  • required: Run review-booster and complete-pr concurrently, then release the changes.
  • chosen: Expose the match-pattern binding through the existing alias field, keeping the current node structure and grammar precedence because the missing metadata needs no syntax change.
  • chosen: Check public field traversal, standard queries and an incremental rename because corpus acceptance tests cannot detect a missing field.

Customer Summary

Consumers can retrieve the binding of case pattern as name through the alias field and standard field queries.

Technical Summary

grammar.js labels 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 through bun wb test test/unit/corpus.test.ts, the new public API regression, and bun run verify passed. 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.testFuncdef in both newline variants (159 NCSS), Python3 example GrammarTests.testFuncdef in both variants (187 NCSS), the Python3.8 example file (1,200 NCSS) and its test_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.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Oct 20, 2026
@exKAZUu
exKAZUu merged commit 580c45a into main Oct 20, 2026
10 checks passed
@exKAZUu
exKAZUu deleted the feat/match-pattern-alias-field branch October 20, 2026 15:07
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