fix(editor): resolve HeadingTitle shift/reduce conflict in Typst grammar
Build and Deploy Verso / deploy (push) Has been cancelled

headingTitleItem* allowed an empty HeadingTitle, causing a shift/reduce
conflict: after HeadingMark, seeing "*" the LR parser couldn't decide
whether to shift it as a Strong inside the heading or reduce HeadingTitle
to empty and treat "*" as a document-level item.

Changing to headingTitleItem+ forces HeadingTitle to be non-empty, so
"*" after HeadingMark must be inside the heading. Empty headings are
handled by Lezer's error recovery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-07 20:35:42 +00:00
parent 5287ea6f00
commit 26da1f6205
@@ -31,7 +31,10 @@ item {
// HeadingMark is produced by an external tokenizer that enforces the
// start-of-line constraint and captures the "=+" prefix + trailing space.
Heading { HeadingMark HeadingTitle }
HeadingTitle { headingTitleItem* }
// headingTitleItem+ (not *) so HeadingTitle is never empty: the generator
// would otherwise produce a shift/reduce conflict on "*" after HeadingMark,
// unable to tell if "*" starts a Strong inside the heading or at doc level.
HeadingTitle { headingTitleItem+ }
headingTitleItem {
Strong | Emphasis | CodeExpr | InlineMath | RawInline | Label | Ref | HeadingText
}