fix(typst): fix zero-length token error for LineCommentContent
Build and Deploy Verso / deploy (push) Has been cancelled
Build and Deploy Verso / deploy (push) Has been cancelled
LineCommentContent { ![\n]* } matches the empty string, which Lezer
rejects as a zero-length token (infinite-loop risk). Change to ![\n]+
and mark it optional in the LineComment rule so empty // comments parse.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,7 +38,7 @@ Heading { HeadingMark HeadingTitle? }
|
||||
// External tokens are context-isolated by the LR state machine — no merging.
|
||||
|
||||
// ── Comments ──────────────────────────────────────────────────────────────
|
||||
LineComment { "//" LineCommentContent }
|
||||
LineComment { "//" LineCommentContent? }
|
||||
// BlockCommentBody is external so it can track nesting depth —
|
||||
// Typst supports /* /* nested */ */ block comments.
|
||||
BlockComment { "/*" BlockCommentBody? "*/" }
|
||||
@@ -182,7 +182,7 @@ Escape { "\\" EscapeChar }
|
||||
}
|
||||
|
||||
// Comment content — everything to end of line.
|
||||
LineCommentContent { ![\n]* }
|
||||
LineCommentContent { ![\n]+ }
|
||||
|
||||
// Math content — everything between the $ delimiters (no crossing newlines).
|
||||
MathContent { ![$\n]+ }
|
||||
|
||||
Reference in New Issue
Block a user