Skip to content

Commit b5ef6c6

Browse files
committed
Fix the YAML issue ledger: specific cites, drop the mislabeled case
Two corrections to the just-added YAML ledger section: 1. The three explicit-key cases cited RedCMD/YAML-Syntax-Highlighter#1 — the cross-ecosystem aggregator issue LIST, not a specific issue. Retarget the two that map verbatim (anchor in `?`-key, bare `?` multi-line sequence key) to #12 ("YAML issues", RedCMD's report against Monogram). 2. Drop the "block scalar used AS an explicit key" case. It claimed official `·`, but the official (maintained RedCMD) grammar does NOT have this bug: it fully recognises the construct — `?` → punctuation.definition.map.key, `|` → keyword.control.flow.block-scalar, content → string.unquoted.block — and deliberately scopes the key's content as a block-scalar string. RedCMD (the grammar's author, who filed #12) never reported it, so it is a defensible design choice, not an official failure. Monogram's entity.name.tag here even mis-scopes the `|` introducer as a name. Including it as a Monogram-only win was wrong. YAML ledger is now 8/8 vs the maintained official 8/8 — Monogram matches a maintained competitor on every filed bug, no inflated wins. Other languages unchanged.
1 parent fca5499 commit b5ef6c6

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The same question, every language at once: take the bugs reported against each *
6666

6767
<!-- issues:start -->
6868
<!-- generated by `npm run bench:issues` — do not edit by hand -->
69-
_Each hand-written **official** grammar vs Monogram's **derived** one, on the bugs filed against it: **TypeScript 26/26** (official 8/26) · **TSX 11/11** (official 5/11) · **HTML 20/20** (official 13/20) · **Vue 23/23** (official 18/23) · **YAML 9/9** (official 8/9). Per-issue detail below — auto-generated by `npm run bench:issues`._
69+
_Each hand-written **official** grammar vs Monogram's **derived** one, on the bugs filed against it: **TypeScript 26/26** (official 8/26) · **TSX 11/11** (official 5/11) · **HTML 20/20** (official 13/20) · **Vue 23/23** (official 18/23) · **YAML 8/8** (official 8/8). Per-issue detail below — auto-generated by `npm run bench:issues`._
7070

7171
#### TypeScript
7272
| issue | Monogram | official |
@@ -193,9 +193,7 @@ _Each hand-written **official** grammar vs Monogram's **derived** one, on the bu
193193
</details>
194194

195195
#### YAML
196-
| issue | Monogram | official |
197-
|---|:--:|:--:|
198-
| [RedCMD/YAML-Syntax-Highlighter#1](https://github.com/RedCMD/YAML-Syntax-Highlighter/issues/1) — a block scalar used AS an explicit key is scoped as a key name || · |
196+
_No asymmetries — both grammars handle all 8 filed bugs below._
199197

200198
<details><summary>… and 8 more both grammars already handle (✓ / ✓)</summary>
201199

@@ -205,8 +203,8 @@ _Each hand-written **official** grammar vs Monogram's **derived** one, on the bu
205203
| [atom/language-yaml#114](https://github.com/atom/language-yaml/issues/114) — a `#` in a block-scalar body is content, not a comment |||
206204
| [tmbundle#38](https://github.com/textmate/yaml.tmbundle/issues/38) — a block scalar with leading/internal EMPTY lines stays one string region |||
207205
| [tmbundle#18](https://github.com/textmate/yaml.tmbundle/issues/18) — JSON-ish punctuation (`{`/`}`) and a tab indicator inside a block scalar stay content |||
208-
| [RedCMD/YAML-Syntax-Highlighter#1](https://github.com/RedCMD/YAML-Syntax-Highlighter/issues/1) — an anchor `&a` in explicit-key (`?`) position is still an anchor |||
209-
| [RedCMD/YAML-Syntax-Highlighter#1](https://github.com/RedCMD/YAML-Syntax-Highlighter/issues/1) — a bare `?` opening an explicit multi-line sequence key is the map-key indicator |||
206+
| [johnsoncodehk/monogram#12](https://github.com/johnsoncodehk/monogram/issues/12) — an anchor `&a` in explicit-key (`?`) position is still an anchor |||
207+
| [johnsoncodehk/monogram#12](https://github.com/johnsoncodehk/monogram/issues/12) — a bare `?` opening an explicit multi-line sequence key is the map-key indicator |||
210208
| [atom/language-yaml#119](https://github.com/atom/language-yaml/issues/119) — an escape inside a double-quoted KEY is highlighted |||
211209
| [tmbundle#39](https://github.com/textmate/yaml.tmbundle/issues/39) — a plain scalar resolving to `null` is lexically a string that resolves to a constant |||
212210

test/yaml-issue-cases.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
// side effects on import). The "official" YAML grammar is the MAINTAINED RedCMD/YAML-Syntax-
33
// Highlighter (microsoft/vscode#232244 switched VS Code off the dead textmate/yaml.tmbundle to it),
44
// so YAML's baseline is a maintained competitor — most of these it ALSO solves. Each id cites the
5-
// underlying upstream tracker; the canonical aggregator is RedCMD/YAML-Syntax-Highlighter#1
6-
// ("Pre-existing grammar issues"), which links the VS Code / textmate-yaml.tmbundle / atom-language-
7-
// yaml issues. The original report against Monogram was johnsoncodehk/monogram#12, since superseded
8-
// by RedCMD's organized #1. Shared by the README cross-language ✓ table (test/issue-table.ts).
5+
// most specific tracker: the ecosystem bugs filed against the official/upstream grammars (VS Code /
6+
// textmate-yaml.tmbundle / atom-language-yaml), and johnsoncodehk/monogram#12 ("YAML issues",
7+
// RedCMD's multi-item report against Monogram) for the explicit-key behaviors that have no single
8+
// dedicated upstream issue. RedCMD/YAML-Syntax-Highlighter#1 ("Pre-existing grammar issues") is the
9+
// broader cross-ecosystem aggregator that links the upstream issues. Shared by the README
10+
// cross-language ✓ table (test/issue-table.ts).
911
//
1012
// Each snippet is VALID YAML; the question is whether the grammar scopes the marked span correctly.
1113
// Same predicate shape as html-issue-cases.ts: {id, title, src, at, nth?, want:(scope)=>boolean}.
1214
// `want` asserts the GENUINELY-correct scope (verified by tokenizing both grammars), not "whatever
13-
// Monogram emits". Several are both-✓ (the maintained RedCMD grammar handles them too) — that is
14-
// honest and correct to show; #119 below is the lone Monogram-only ✓ in this set.
15+
// Monogram emits". ALL are both-✓: the maintained RedCMD grammar handles them too — the honest
16+
// result is that Monogram MATCHES a maintained competitor on every one of these filed bugs (no
17+
// inflated "Monogram-only" wins; e.g. a block scalar used as an explicit key is NOT included —
18+
// RedCMD's grammar deliberately scopes the key's content as a block-scalar string and never filed
19+
// it as a bug, so it is a defensible design choice, not an official failure).
1520

1621
export interface YamlCase { id: string; title: string; src: string; at: string; nth?: number; want: (scope: string) => boolean; }
1722

@@ -20,7 +25,6 @@ const isEscape = (s: string) => s.includes('constant.character.escape');
2025
const isAnchor = (s: string) => s.includes('anchor') && !!s.replace(/source\.yaml/g, '').match(/entity\.name|variable\.other/); // an anchor scope, not bare source
2126
const isMapKeyPunct = (s: string) => s.includes('punctuation.definition.map.key'); // the `?` explicit-key indicator
2227
const isDocMarker = (s: string) => s.includes('entity.other.document') || s.includes('keyword.control');
23-
const isTag = (s: string) => s.includes('entity.name.tag'); // scoped as a key NAME (entity.name.tag.yaml)
2428
const stringResolvesTo = (lang: string) => (s: string) => s.includes('string.unquoted') && s.includes(lang); // plain scalar is lexically a string that RESOLVES to a typed constant
2529

2630
export const cases: YamlCase[] = [
@@ -37,13 +41,10 @@ export const cases: YamlCase[] = [
3741
at: '}', want: isBlockScalar }, // the `}` is literal block-scalar content, not punctuation — and the indicator follows a TAB (tmbundle#18: `{ }` inside literal style breaks highlighting; #17 is the sibling colon case)
3842

3943
// ── explicit-key (`?`) constructs ──
40-
{ id: 'RedCMD/YAML-Syntax-Highlighter#1', title: 'an anchor `&a` in explicit-key (`?`) position is still an anchor', src: '? &a a\n: &b b\n: *a\n',
44+
{ id: 'johnsoncodehk/monogram#12', title: 'an anchor `&a` in explicit-key (`?`) position is still an anchor', src: '? &a a\n: &b b\n: *a\n',
4145
at: '&a', want: isAnchor }, // `&a` after the explicit-key `?` is an anchor (entity.name.type.anchor / variable.other.anchor), not bare source — the original monogram#12 multi-item repro
42-
{ id: 'RedCMD/YAML-Syntax-Highlighter#1', title: 'a bare `?` opening an explicit multi-line sequence key is the map-key indicator', src: '?\n- a\n- b\n:\n- c\n- d\n',
46+
{ id: 'johnsoncodehk/monogram#12', title: 'a bare `?` opening an explicit multi-line sequence key is the map-key indicator', src: '?\n- a\n- b\n:\n- c\n- d\n',
4347
at: '?', want: isMapKeyPunct }, // the lone `?` (its value is the multi-line block sequence below) is punctuation.definition.map.key.yaml — both grammars handle the explicit complex-key form
44-
{ id: 'RedCMD/YAML-Syntax-Highlighter#1', title: 'a block scalar used AS an explicit key is scoped as a key name', src: '? |\n block key\n: v\n',
45-
at: 'block key', want: isTag }, // MONOGRAM-ONLY ✓: Monogram scopes the block-scalar explicit key as a key NAME (entity.name.tag.yaml); the official leaves it string.unquoted.block (it has no entity.name.tag) → only-Monogram
46-
4748
// ── quoted KEYS carry their escapes / plain scalars carry a string ancestor ──
4849
{ id: 'atom/language-yaml#119', title: 'an escape inside a double-quoted KEY is highlighted', src: '"foo\\nbar": 23\n',
4950
at: '\\n', want: isEscape }, // the `\n` inside the quoted key `"foo\nbar"` is constant.character.escape (atom#119: keys with escaped chars within are not highlighted correctly) — both grammars sub-scope escapes inside the key now

0 commit comments

Comments
 (0)