Parser: a colon then blanks at the end of a line is read as an empty alias #281
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#281
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found by the fuzz (
format-preserves-meaning, seed 1515514652, index 5209 ondev/1.6), present onmainanddev/1.6.alias = ":" refNameinpackages/parser/grammar.ohmaccepts an alias made of blanks only. After a bare ingredient or cookware at the end of a line, the blanks become an empty alias and the colon vanishes from the step:Add @salt:+ line break →["Add ", salt, " ", "ok."](colon lost)Add @salt:+ line break →["Add ", salt, ":", " ", "ok."](colon kept)gram formatstrips the trailing blank, so formatting changes the compiled recipe. Minimal input from the fuzz:Fix: blanks alone up to the end of the line (LF, CRLF, lone CR) or of the file are no alias; the colon stays text.
Follow-ups:
tree-sitter-gramhas the same behavior (src/scanner.c,ALIAS_COLONemitted as soon asref_name_end > 0, blanks included): only the highlighting of the:is affected, to sync later.Add @salt: a pinch.still reads "a pinch." as the alias of a bare ingredient (the alias swallows the rest of the line); changing that is a syntax change (RFC).