fix(parser): read a colon followed by a blank as punctuation, not an alias #303

Merged
abiwab merged 1 commit from fix/parser-alias-no-leading-blank into dev/1.6 2026-11-27 22:00:53 +01:00
Owner

Fixes #273.

alias = ":" refName accepted an alias name starting with a blank, so a : written as punctuation after a bare mention read the rest of the line as its alias, and that text vanished from the step with no message (Heat the #pan: then add oil. → cookware pan, alias "then add oil.").

  • Grammar: alias = ":" ~sp refName. The alias starts right after the colon, with no blank (@dry white wine:wine{10ml}, #cast iron skillet:skillet{} unchanged); a colon followed by a space or a tab is text. This also covers #281 (blanks alone up to the end of the line), so the previous lookahead goes.
  • Tests: grammar-edge-cases.test.ts, new block for #273; the #282 test that read @salt: fleur de sel. as an alias now uses the glued form. Fuzz input in fuzz/regressions/273-colon-blank-alias.gram.
  • Docs: ingredients.mdx and cookware.mdx (en + fr) say the alias is glued to the colon, <Since v="1.6.0" />.
  • Changeset: minor for @gram-lang/parser (a recipe writing @salt: fleur de sel{1g} must glue the alias).

Checks: 4352 tests, 0 fail; conformance 148/148 and 24/24 with no golden change; lint, deprecations:check; fuzz 50k (seed 778388986, 0 signature).

tree-sitter-gram: same rule in the scanner, branch fix/alias-no-leading-blank (corpus 77/77, conformance 160/160, oracle 236/236 against this parser). It is tagged and pinned once @gram-lang/parser 1.6.0 is published, since its oracle runs against the npm parser.

Fixes #273. `alias = ":" refName` accepted an alias name starting with a blank, so a `:` written as punctuation after a bare mention read the rest of the line as its alias, and that text vanished from the step with no message (`Heat the #pan: then add oil.` → cookware `pan`, alias `"then add oil."`). - **Grammar**: `alias = ":" ~sp refName`. The alias starts right after the colon, with no blank (`@dry white wine:wine{10ml}`, `#cast iron skillet:skillet{}` unchanged); a colon followed by a space or a tab is text. This also covers #281 (blanks alone up to the end of the line), so the previous lookahead goes. - **Tests**: `grammar-edge-cases.test.ts`, new block for #273; the #282 test that read `@salt: fleur de sel.` as an alias now uses the glued form. Fuzz input in `fuzz/regressions/273-colon-blank-alias.gram`. - **Docs**: ingredients.mdx and cookware.mdx (en + fr) say the alias is glued to the colon, `<Since v="1.6.0" />`. - **Changeset**: `minor` for `@gram-lang/parser` (a recipe writing `@salt: fleur de sel{1g}` must glue the alias). Checks: 4352 tests, 0 fail; conformance 148/148 and 24/24 with no golden change; lint, deprecations:check; fuzz 50k (seed 778388986, 0 signature). **tree-sitter-gram**: same rule in the scanner, branch `fix/alias-no-leading-blank` (corpus 77/77, conformance 160/160, oracle 236/236 against this parser). It is tagged and pinned once `@gram-lang/parser` 1.6.0 is published, since its oracle runs against the npm parser.
fix(parser): read a colon followed by a blank as punctuation, not an alias
All checks were successful
CI / Build & Test (pull_request) Successful in 6m10s
cb37a6c436
abiwab merged commit fdd147bad7 into dev/1.6 2026-11-27 22:00:53 +01:00
abiwab deleted branch fix/parser-alias-no-leading-blank 2026-11-27 22:00:54 +01:00
Sign in to join this conversation.
No description provided.