fix: terminates math calls before identifier start (#1117)

This commit is contained in:
Myriad-Dreamin 2025-01-06 21:53:38 +08:00 committed by GitHub
parent b7feb5dcca
commit a00e5f12e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View file

@ -1430,7 +1430,7 @@ const mathFuncCallOrPropAccess = (): textmate.Pattern => {
begin: lookAhead(
new RegExp(/(\.)?/.source + MATH_IDENTIFIER.source + /(?=\(|\[)/.source)
),
end: /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\s;\,\}\]\)]|$)/,
end: /(?:(?<=\)|\])(?:(?![\[\(\.\p{XID_Start}])|$))|(?=[\s;,\}\]\)]|$)/u,
patterns: [
{
match: /\./,

View file

@ -1,3 +1,7 @@
>
>// todo: solve it in future
#^^ source.typst comment.line.double-slash.typst punctuation.definition.comment.typst
# ^^^^^^^^^^^^^^^^^^^^^^^^^ source.typst comment.line.double-slash.typst
>#math.abs/**/()
#^ source.typst variable.other.readwrite.hash.typst
# ^^^^ source.typst variable.other.readwrite.typst

View file

@ -0,0 +1 @@
$upright(A)upright(m)$ "Test it."

View file

@ -0,0 +1,13 @@
>$upright(A)upright(m)$ "Test it."
#^ source.typst markup.math.typst punctuation.definition.string.math.typst
# ^^^^^^^ source.typst markup.math.typst meta.expr.call.typst entity.name.function.typst
# ^ source.typst markup.math.typst meta.expr.call.typst meta.brace.round.typst
# ^ source.typst markup.math.typst meta.expr.call.typst
# ^ source.typst markup.math.typst meta.expr.call.typst meta.brace.round.typst
# ^^^^^^^ source.typst markup.math.typst meta.expr.call.typst entity.name.function.typst
# ^ source.typst markup.math.typst meta.expr.call.typst meta.brace.round.typst
# ^ source.typst markup.math.typst meta.expr.call.typst
# ^ source.typst markup.math.typst meta.expr.call.typst meta.brace.round.typst
# ^ source.typst markup.math.typst punctuation.definition.string.math.typst
# ^^^^^^^^^^^^ source.typst
>