fix(typst): add CodeArray so tuple args don't break nested call parsing
Build and Deploy Verso / deploy (push) Successful in 9m44s

align: (left, center, left) is a Typst array literal.  Without a grammar
rule for it, the parser treated the ')' closing the tuple as the ')' closing
the enclosing function call, so everything after align: — all ContentBlock
args and any subsequent named keys like 'caption:' — fell outside the parsed
call tree and was highlighted as MarkupContent.

Add CodeArray { "(" codeArgList? ")" } as a codeValue alternative so
parenthesised arrays and dictionaries parse correctly.  Also regenerate
typst.mjs / typst.terms.mjs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-09 20:13:38 +00:00
parent 8ed44cc352
commit 056d9a7f47
3 changed files with 26 additions and 20 deletions
@@ -106,9 +106,14 @@ codeValue {
CodeIdent |
ContentBlock |
CodeBlock |
InlineMath
InlineMath |
CodeArray
}
// Typst array / tuple / dictionary literal: (a, b) or (key: val, …)
// Reuses codeArgList so named-key entries like (auto, 1fr) work too.
CodeArray { "(" codeArgList? ")" }
// CodeBlockBody depth-tracks braces so #{ let x = { 1 } } parses correctly.
CodeBlock { "{" CodeBlockBody? "}" }
// ContentBlock re-enters markup mode, allowing #[*bold* text].
File diff suppressed because one or more lines are too long
@@ -32,15 +32,16 @@ export const
ContentBlock = 30,
CodeBlock = 31,
InlineMath = 32,
AtomExpr = 33,
Strong = 34,
Emphasis = 35,
Label = 36,
LabelName = 37,
Ref = 38,
RefName = 39,
Escape = 40,
EscapeChar = 41,
URL = 42,
MarkupContent = 43,
ClosingSquare = 44
CodeArray = 33,
AtomExpr = 34,
Strong = 35,
Emphasis = 36,
Label = 37,
LabelName = 38,
Ref = 39,
RefName = 40,
Escape = 41,
EscapeChar = 42,
URL = 43,
MarkupContent = 44,
ClosingSquare = 45