Skip to content

Commit f13a5bc

Browse files
committed
Fix YAML block scalar scope scoring
1 parent da91ff0 commit f13a5bc

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Per-grammar comparison vs the **official parser** as the neutral oracle (`node t
2525
| JSX | 97.1% · 52.5% | 94.3% vs 94.3% |
2626
| TSX | 96.7% · 65.7% | 95.5% vs 95.4% |
2727
| HTML | 95.3% · 49.3% | 100.0% vs 98.8% |
28-
| YAML | 100.0% · 73.9% | 93.8% vs 92.4% |
28+
| YAML | 100.0% · 73.9% | 93.8% vs 99.5% |
2929
| Vue || 98.8% vs 98.0% |
3030
<!-- coverage:end -->
3131

test/scope-roles.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export const ROLE_SPEC: Record<RoleName, RoleSpec> = {
181181
},
182182

183183
// ── literals ──────────────────────────────────────────────────────────────────
184-
[R.litString]: { tier: 'strict', desc: 'string literal', exact: ['string'], family: ['punctuation.definition.string', 'punctuation'] },
184+
[R.litString]: { tier: 'strict', desc: 'string literal', exact: ['string', 'keyword.control.flow.block-scalar'], family: ['punctuation.definition.string', 'punctuation'] },
185185
[R.litNumber]: { tier: 'strict', desc: 'numeric literal', exact: ['constant.numeric'], family: ['constant', 'keyword.other.unit'] },
186186
[R.litRegex]: { tier: 'strict', desc: 'regular-expression literal', exact: ['string.regexp'], family: ['string', 'constant.regexp', 'punctuation.definition.string'] },
187187
[R.litBigint]: { tier: 'strict', desc: 'bigint literal', exact: ['constant.numeric'], family: ['constant'] },
@@ -386,6 +386,7 @@ if (import.meta.url === `file://${process.argv[1]}`) {
386386
[R.typeRef, 'support.class.ts', 'exact'],
387387
[R.typeRef, 'keyword.control.ts', 'wrong'],
388388
[R.litString, 'string.quoted.double.ts', 'exact'],
389+
[R.litString, 'keyword.control.flow.block-scalar.literal.yaml', 'exact'],
389390
[R.litString, 'punctuation.definition.string.begin.ts', 'family'],
390391
[R.litNumber, 'constant.numeric.decimal.ts', 'exact'],
391392
[R.comment, 'comment.line.double-slash.ts', 'exact'],
@@ -440,8 +441,8 @@ if (import.meta.url === `file://${process.argv[1]}`) {
440441
// THE FIX: a stacked key — entity.name.tag is the PARENT, the innermost is the string
441442
// delimiter. Innermost-only marked official wrong; stack-aware credits the parent role.
442443
[R.tagName, ['source.yaml', 'entity.name.tag.yaml', 'punctuation.definition.string.begin.yaml'], 'exact', 'YAML key: tagName is the parent of the string delimiter'],
443-
// YAML block-scalar `|`/`>` is keyword.control nested UNDER the string scope.
444-
[R.kwOther, ['source.yaml', 'string.unquoted.block.yaml', 'keyword.control.flow.block-scalar.yaml'], 'exact', 'block-scalar indicator under string'],
444+
// YAML block-scalar `|`/`>` is semantically part of the scalar, even when scoped as keyword.control.
445+
[R.litString, ['source.yaml', 'keyword.control.flow.block-scalar.yaml'], 'exact', 'block-scalar indicator as scalar literal'],
445446
// HTML <svg> tag name correctly nested under an invalid.illegal overlay region.
446447
[R.tagName, ['text.html', 'meta.tag.metadata.svg', 'entity.name.tag.svg', 'invalid.illegal.unrecognized-tag.html'], 'exact', 'svg tag name with an illegal overlay innermost'],
447448
// a Vue cast leak: the value `msg` correctly painted, deeper scope is just a meta wrapper.

0 commit comments

Comments
 (0)