fix(parser): keep a colon followed by blanks alone as text, not an empty alias #282
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!282
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/parser-colon-after-bare-ingredient"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #281.
alias = ":" refNameaccepted an alias made of blanks only: after a bare ingredient or cookware at the end of a line (Add @salt:+ line break), the blanks became an empty alias and the colon vanished from the step, while@salt:kept it.gram formatstrips the trailing blank, so formatting changed the recipe (fuzzformat-preserves-meaning).alias = ":" ~(sp* (nl | end)) refName. Blanks alone up to a line break (LF, CRLF, lone CR) or the end of the file are no alias; the colon stays text. Real aliases are unchanged (@dry white wine:wine{100ml},@salt: fleur de sel.), and so is@salt: {1}.packages/parser/tests/grammar-edge-cases.test.ts(7 fail on the old grammar), plus the fuzz input infuzz/regressions/281-colon-blank-alias.gram.patchchangeset for@gram-lang/parser.Checks: 3929 pass / 1 skip / 0 fail, conformance 142/142 and 24/24 with no golden change, typecheck, biome,
deprecations:check, audit 126, fuzz 50k (seed 2768684730, 0 signature).Follow-ups (in #281):
tree-sitter-gramsync for the highlighting of the:;@salt: a pinch.reading the rest of the line as an alias is out of scope (syntax change).