Constrain the deferred declaration path to a dotted name#2
Merged
Conversation
deferred_declaration read its path as $._expression, so calls, comparisons, and parenthesised forms parsed as deferred paths, and the qualified form billing/InvoiceWorkflow parsed as division. The reference parser constrained the path in juxt/allium-tools#24 (juxt/allium-tools#39); this mirrors that grammar: deferred_path: identifier ('/' identifier)? ('.' identifier)* with an optional trailing string_literal location hint (`deferred Foo.bar "detailed/foo.allium"`), now part of the grammar on both sides. Known divergence from the reference parser: the path and hint are required to sit on one line there, which this grammar does not enforce (newlines are extras). Corpus: dotted-path expectation updated to the new node shape; new cases for the qualified path, the quoted hint, and an :error test for an expression-shaped path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 12, 2026
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.
Sibling change to juxt/allium-tools#39 (issue juxt/allium-tools#24): the deferred declaration path is now a dotted name with an optional
use-alias qualifier and an optional quoted location hint, mirroring the reference parser.What changes
deferred_declarationpreviously read its path as$._expression, so calls (deferred Foo("x")), comparisons, and parenthesised forms parsed as deferred paths, and the qualified formbilling/InvoiceWorkflowparsed as a division expression. It now reads:The quoted location hint (
deferred Foo.bar "detailed/foo.allium") is part of the grammar per the decision on juxt/allium-tools#24, exposed as thehintfield.Known divergence from the reference parser: allium-tools requires the path and hint to sit on one line (its line guards prevent a dangling
.or/from absorbing the next declaration's keyword); newlines are extras in this grammar, so that constraint is not enforced here.Node shape change: a dotted path is now
(deferred_path (identifier) (identifier))instead of(member_expression ...). The bundled highlight queries don't reference deferred paths, so no query changes are needed. (Noticed in passing:deferred,open,contract, andinvariantare absent from the@keywordlist inhighlights.scm— pre-existing, left for a separate change.)Verification
npx tree-sitter generateis clean; generatedsrc/committed per repo convention.npx tree-sitter test: 98/98 corpus parses pass — the dotted-path expectation updated to the new shape, plus new cases for the qualified path, the quoted hint, and an:errortest for an expression-shaped path.-- see:comment, qualified, quoted hint) — all produce the expected trees.🤖 Generated with Claude Code