You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detect YAML plain-scalar folds from the rules instead of a proxy gate
The multi-line plain-scalar fold regions (gen-tm §2a′/§2a″) were emitted whenever a
plain token existed (`repository['plain']`) — a proxy that re-encoded, by hand, fold
logic the parser already expresses in its rules (foldedPlain / foldedPlainBlock /
DocFold, assembled from the lexer's Indent/Dedent/Newline tokens). Drive the emission
from the rules instead: a new `detectFold(grammar)` walks the rules and reports whether
a plain-scalar LEAF token repeats across an indent boundary — `Indent <leaf> … Dedent`
(a DEEPER continuation → §2a′) and/or `Newline <leaf>` (a SAME-COLUMN continuation →
§2a″). A leaf is a token with a `blockPattern` + scope; an `Indent`/`Newline` followed
by a RULE ref (a sequence item / mapping entry) is a sibling, not a fold, so only a
leaf token after the boundary counts.
Now each region is emitted only when its fold actually exists in the grammar:
`#plain-continuation` iff `hasDeeper`, `#plain-bare-fold` iff `hasSameColumn`. An
indentation grammar whose plain scalars never fold gets neither (no over-emission),
so the highlighter generalises beyond YAML. This makes parser↔highlighter consistency
by-construction: the fold is expressed once (in the rules) and consumed by both.
YAML has both fold kinds, so both regions are still emitted and the generated grammar
is BYTE-IDENTICAL (git diff yaml.tmLanguage.json empty) — proving this is purely a
hand-gated → rule-detected change with zero output difference. yaml-issue12-regressions
6 pass / 4 known-bug / 0 regression; agnostic 9/9; sanity 15/15; scope-roles 47/47 +
9/9; RedCMD Onigmo diagnostics clean; the other six grammars unchanged.
Refs #12
0 commit comments