typst: fix CodeIdent vs "_" token overlap after #keyword CallExpr?
Build and Deploy Verso / deploy (push) Failing after 8m41s
Build and Deploy Verso / deploy (push) Failing after 8m41s
KeywordExpr { CodeKeyword CallExpr? } merges the post-keyword LR state
with document-level markup states, where "_" opens Emphasis. CodeIdent
starts with identHead which includes "_", so the two tokens overlap.
Adding "_" after CodeIdent in @precedence resolves the conflict: CodeIdent
wins in the merged state (correct for '#set _name(...)'), and in pure markup
states CodeIdent is not in the valid set so "_" still opens Emphasis.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -222,7 +222,11 @@ Escape { "\\" EscapeChar }
|
|||||||
// "(" > "." > "]" > text tokens: after '#' CodeIdent, callSuffix delimiters
|
// "(" > "." > "]" > text tokens: after '#' CodeIdent, callSuffix delimiters
|
||||||
// must win over MarkupContent/StrongText/EmphText in merged states.
|
// must win over MarkupContent/StrongText/EmphText in merged states.
|
||||||
// LineCommentContent and MathContent are external tokens — not listed here.
|
// LineCommentContent and MathContent are external tokens — not listed here.
|
||||||
@precedence { CodeKeyword CodeBool CodeIdent EscapeChar "(" "." "]" spaces MarkupContent StrongText EmphText }
|
// "_" added after CodeIdent: KeywordExpr { CodeKeyword CallExpr? } merges
|
||||||
|
// the post-keyword state with markup states where "_" starts Emphasis.
|
||||||
|
// CodeIdent wins so '#set _name(...)' is tokenised correctly; in pure markup
|
||||||
|
// states CodeIdent is not in the valid set so "_" still opens Emphasis.
|
||||||
|
@precedence { CodeKeyword CodeBool CodeIdent EscapeChar "(" "." "]" "_" spaces MarkupContent StrongText EmphText }
|
||||||
}
|
}
|
||||||
|
|
||||||
@skip { spaces }
|
@skip { spaces }
|
||||||
|
|||||||
Reference in New Issue
Block a user