Commit bc1b10c
committed
Scope a YAML block-scalar explicit key like a block scalar, not a name
A block scalar used as an explicit key (`? |` / `? >`) was scoped entirely as
`entity.name.tag` — including the `|`/`>` introducer. But `|`/`>` is a block-scalar
control sigil, never a name (this is exactly what fca5499 fixed for value-position
block scalars); painting it as a name in key position was the same mis-scope left on
one branch. And once the introducer is a keyword, the body should be a string too,
for coherence: a block scalar is `<keyword indicator><string body>` everywhere, and
the key-ness of a `? |` key is already carried by the `?` (map-key punctuation) and
the `:` separator — recolouring the body as a name only in key position makes the
construct look unlike itself depending on position. The maintained official grammar
does the coherent thing, and loses no information.
Now `? |\n k\n: v` → `?`=punctuation.definition.map.key, `|`=keyword.control.flow.
block-scalar, body=string.unquoted.block (matching official). The oracle splits a
block-scalar key the same as a value (block-indicator + string body), so both
grammars are graded correct — the earlier false "Monogram-only" win is gone and the
official baseline is no longer unfairly penalised (YAML official 98.9% -> 99.0%,
gap +0.3 -> +0.2; Monogram still 99.2%). Parser 100% aligned; other six grammars
byte-identical.1 parent 4d25dba commit bc1b10c
3 files changed
Lines changed: 21 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4636 | 4636 | | |
4637 | 4637 | | |
4638 | 4638 | | |
| 4639 | + | |
| 4640 | + | |
4639 | 4641 | | |
4640 | 4642 | | |
4641 | 4643 | | |
| |||
4736 | 4738 | | |
4737 | 4739 | | |
4738 | 4740 | | |
| 4741 | + | |
| 4742 | + | |
4739 | 4743 | | |
4740 | 4744 | | |
4741 | 4745 | | |
| |||
4826 | 4830 | | |
4827 | 4831 | | |
4828 | 4832 | | |
4829 | | - | |
4830 | | - | |
4831 | | - | |
4832 | | - | |
4833 | | - | |
4834 | | - | |
4835 | | - | |
| 4833 | + | |
| 4834 | + | |
| 4835 | + | |
| 4836 | + | |
| 4837 | + | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
4836 | 4841 | | |
4837 | | - | |
4838 | 4842 | | |
4839 | 4843 | | |
4840 | 4844 | | |
4841 | 4845 | | |
4842 | | - | |
| 4846 | + | |
4843 | 4847 | | |
4844 | 4848 | | |
4845 | 4849 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
| 634 | + | |
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
| 653 | + | |
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
| |||
0 commit comments