Expand description
The grammar: the embedded css-grammar.jsonic text, and the reader that
turns it into the rule table machine runs.
css-grammar.jsonic at the repository root is the SINGLE SOURCE OF TRUTH
for the rules. ts/embed-grammar.js copies it verbatim into ts/src/css.ts,
go/css.go and the GRAMMAR_TEXT literal below. Never hand-edit between
the BEGIN/END EMBEDDED markers — edit the .jsonic file and re-run
npm run embed from ts/.
The TypeScript and Go ports read that text with a jsonic engine, which they
already depend on. This port has no engine under it, so it carries the
small reader below: enough of the jsonic dialect to read THIS document —
# comments, {} maps with bare or quoted keys, [] lists, bare and
quoted scalars, and newline-separated entries with commas optional. It is
deliberately not a jsonic implementation; tests/grammar.rs pins what it
accepts.
Structs§
- Alt
- One alternative of a rule’s
openorcloselist. - Grammar
- The rule table read out of the embedded grammar text (see
grammar_text). - RuleDef
- One grammar rule: the alts tried when it opens, and when it closes.
Functions§
- grammar_
text - The verbatim
css-grammar.jsonictext this crate was built from. Exposed so a test can compare it against the file on disk and catch an embed that was never re-run.