Commit 024c03a
committed
Revise frontmatter grammar, add ⊥ rule
The prior commit added a grammar for frontmatter, but the grammar
notation available at the time that commit was prepared couldn't
express all of the invariants the language requires. Opening and
closing fences must have the same dash count. Indented fences must
be rejected as an error. And once an opening fence is recognized,
the parser must commit -- it can't backtrack and reinterpret the
dashes as tokens.
Since then, we've added named range repeats, hard cut, and negative
lookahead to the grammar notation. With these, we can express the
invariants directly.
In this commit, we rewrite the frontmatter grammar. Named range
repeats let the closing fence reference the opening fence's
dash count. Hard cut commits the parse after the opening
dashes. And `FRONTMATTER_INVALID` uses hard cut followed by
the bottom rule (`^ ⊥`) to express that indented fences are a
recognized-and-rejected syntactic form. We also add `⊥` as a
primitive rule in the Notation chapter, move `HORIZONTAL_WHITESPACE`
to Whitespace, and fix some minor editorial matters such as
indentation and comment style.1 parent fafe84b commit 024c03a
3 files changed
Lines changed: 38 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | | - | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | | - | |
27 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
0 commit comments