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
A type parameter named `in`/`out` preceded by a variance modifier
(`type T1<in in>`, `type T2<out out>`) failed to parse: the greedy
`many1(mod)` consumed both keywords, leaving no name and no backtrack.
TS treats the last `in`/`out` before the terminator as the name.
Add a single-modifier `[mod, name]` branch where the name may itself be
a contextual variance keyword, and let longest-match arbitrate against
the modifier-soup and bare-name branches. Verified no regressions across
the conformance suite.
Regenerate all derived targets (TextMate, tree-sitter, Lezer, Monarch)
from the merged grammar and update README conformance figures.
Copy file name to clipboardExpand all lines: README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ A TextMate grammar is a pile of regexes guessing at a language's structure. It's
10
10
11
11
Monogram inverts the dependency:
12
12
13
-
1.**Write the grammar, then prove it.** The grammar is executable. Monogram runs it as a recursive-descent + Pratt parser over the TypeScript conformance suite. Today it parses **95.0%** (3589 / 3776 files); the goal is **100% coverage of the official parser** — at which point the grammar is a *verified, complete model* of the language's syntax, not an approximation.
13
+
1.**Write the grammar, then prove it.** The grammar is executable. Monogram runs it as a recursive-descent + Pratt parser over the TypeScript conformance suite. Today it parses **95.4%** (3602 / 3776 files); the goal is **100% coverage of the official parser** — at which point the grammar is a *verified, complete model* of the language's syntax, not an approximation.
14
14
15
15
2.**Derive the highlighter from the proven grammar.** The TextMate grammar is generated from that same parser-validated grammar — never hand-written. Its correctness is underwritten by the parser conformance run, not by regex tuning.
16
16
@@ -37,7 +37,7 @@ And — from the same grammar — first-pass generators for the rest of the edit
37
37
Validated on TypeScript (grammar: [`examples/typescript.ts`](examples/typescript.ts), 537 lines):
38
38
39
39
```
40
-
Parser conformance 95.0% 3589 / 3776 files from the TypeScript conformance suite (goal: 100%)
40
+
Parser conformance 95.4% 3602 / 3776 files from the TypeScript conformance suite (goal: 100%)
41
41
Highlighter 99.3% 589 / 593 tokens match VS Code's official grammar
42
42
Generated grammar 42 KB vs the official hand-written 226 KB
43
43
Engine language-agnostic — no TypeScript-specific code
// - Rule Expr: Pratt operators (op/prefix/postfix) mapped to precedence-marked binary/unary alternatives. Lezer is GLR + @precedence, not Pratt, so deeply overloaded operators (e.g. '<' as both comparison and type-args, '+' infix vs prefix) may need hand-tuning or the external tokenizer to fully disambiguate.
340
-
// - Block-style token JSDoc (delimiters "\\/\\*\\*"…"\\*\\/") routed to the external tokenizer; Lezer single tokens can't longest-match a multi-char close delimiter.
340
+
// - Block-style token JSDoc (delimiters "\\/\\*\\*(?!\\/)"…"\\*\\/") routed to the external tokenizer; Lezer single tokens can't longest-match a multi-char close delimiter.
341
341
// - Block-style token BlockComment (delimiters "\\/\\*"…"\\*\\/") routed to the external tokenizer; Lezer single tokens can't longest-match a multi-char close delimiter.
0 commit comments