Follow-up from the Earley→LALR parser PR (#1682).
Context
The LALR grammar bundles a trailing WHERE into its match_clause (so WHERE binds to its preceding clause declaratively, which eliminated the WITH..WHERE attachment ambiguity). To keep that change AST-byte-identical, the query_body transformer currently re-flattens a bundled MatchClause(where=…) back into a [match, where] item sequence so the pre-existing clause-sequence assembler (a state machine that predates the bundling) runs untouched.
Ask
Have the assembler consume MatchClause.where directly and delete the positional WHERE-attachment inference. Re-prove equivalence with the existing differentials (test_grammar_invariants.py + test_differential_grammar_parity.py — byte-identical ASTs, rejection parity). With the seam gone, the AST's WHERE-related fields may also be simplified (the AST is an internal contract, safe to redesign with consumers refactored in lockstep + differential re-proven).
Scoped, low-risk, no new machinery. Parser-only.
🤖 tracked via Claude Code
Follow-up from the Earley→LALR parser PR (#1682).
Context
The LALR grammar bundles a trailing
WHEREinto itsmatch_clause(so WHERE binds to its preceding clause declaratively, which eliminated the WITH..WHERE attachment ambiguity). To keep that change AST-byte-identical, thequery_bodytransformer currently re-flattens a bundledMatchClause(where=…)back into a[match, where]item sequence so the pre-existing clause-sequence assembler (a state machine that predates the bundling) runs untouched.Ask
Have the assembler consume
MatchClause.wheredirectly and delete the positional WHERE-attachment inference. Re-prove equivalence with the existing differentials (test_grammar_invariants.py+test_differential_grammar_parity.py— byte-identical ASTs, rejection parity). With the seam gone, the AST's WHERE-related fields may also be simplified (the AST is an internal contract, safe to redesign with consumers refactored in lockstep + differential re-proven).Scoped, low-risk, no new machinery. Parser-only.
🤖 tracked via Claude Code