Skip to content

Commit 387b650

Browse files
committed
Fix two more sep-omission twins of the type-param keyword drop (#51)
An adversarial gap-hunt (5 agents over the classes the structural checker does NOT cover) found that the getTypeParamElementKeywords `sep` drop had un-fixed siblings in the same family: - detectTypeParamConstraintKeywords.scanConstraint omitted `sep`, so a type-parameter CONSTRAINT keyword reached through a `&`/`,`-separated list was not collected — the .tsx generic-arrow⇄JSX no-comma disambiguation lost its constraint signal (mis-scoping the header as a JSX tag). - detectDeclarations.containsBlockRef omitted `sep`, so a declaration whose brace body is reached through a `sep` was not seen as having a body — its #declaration-body member-scoping region was dropped. Both recurse into `sep.element` now, mirroring the prior fix. Byte-identical on all six shipped grammars (latent: every shipped grammar writes constraints as `opt('extends', Type)` and block bodies as direct refs). The hunt found 8 latent completeness gaps total; all were VERIFIED latent — tokenizing the witnesses against the shipped grammars shows ternary, calls, trailing-comma type params, and every prec operator are correctly scoped, so the 0-gap soundness ledger is real, not corpus-blind. The remaining gaps are detector SHAPE-FRAGILITY (fixed-offset window matching in detectTernary / detectCallExpression / isAngleBracketSepRule misses equivalent factorings), an unimplemented `rawBlock` config region, and punctuation-in-region — tracked for follow-up; none triggers on a shipped grammar.
1 parent 978cd2c commit 387b650

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/gen-tm.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,10 @@ function detectTypeParamConstraintKeywords(grammar: CstGrammar, typeArgRule: str
11091109
for (const it of (expr as { items: RuleExpr[] }).items) scanConstraint(it);
11101110
} else if (expr.type === 'group') {
11111111
scanConstraint((expr as { body: RuleExpr }).body);
1112+
} else if (expr.type === 'sep') {
1113+
// a constraint keyword reached through a `&`/`,`-separated sub-list is just as direct —
1114+
// recurse into the element (mirrors getTypeParamElementKeywords' `sep` arm).
1115+
scanConstraint((expr as { element: RuleExpr }).element);
11121116
}
11131117
};
11141118
for (const rule of grammar.rules) {
@@ -3157,6 +3161,7 @@ function detectDeclarations(grammar: CstGrammar, tokenNames: Set<string>): DeclI
31573161
if (expr.type === 'ref') return isBlockRule(expr.name);
31583162
if (expr.type === 'seq' || expr.type === 'alt') return expr.items.some(containsBlockRef);
31593163
if (expr.type === 'quantifier' || expr.type === 'group') return containsBlockRef(expr.body);
3164+
if (expr.type === 'sep') return containsBlockRef(expr.element);
31603165
return false;
31613166
}
31623167

0 commit comments

Comments
 (0)