fix: better grammar on incomplete AST (#140)

* dev: error tolerance on editing let/show statements

* dev: error tolerance on editing if/show statements

* dev: error tolerance on editing while/for statements

* dev: error tolerance on editing if/while/for statements

* dev: better token for and or not
This commit is contained in:
Myriad-Dreamin 2024-04-01 01:51:42 +08:00 committed by GitHub
parent 38c54a70da
commit 2e39afde78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 336 additions and 56 deletions

View file

@ -439,7 +439,7 @@ const expression = (): textmate.Grammar => {
},
{
match: /\b(and|or|not)\b(?!-)/,
name: "keyword.operator.logical.typst",
name: "keyword.other.logical.typst",
},
{
match: /\b(return)\b(?!-)/,
@ -462,6 +462,7 @@ const expression = (): textmate.Grammar => {
{ include: "#primitiveColors" },
{ include: "#primitiveFunctions" },
{ include: "#primitiveTypes" },
// todo: enable if only if for completely right grammar
{ include: "#identifier" },
{ include: "#constants" },
{
@ -817,7 +818,7 @@ const letStatement = (): textmate.Grammar => {
const letBindingClause: textmate.Pattern = {
// name: "meta.let.binding.typst",
begin: /(let\b(?!-))\s*/,
end: /(?=[=;\]}])/,
end: /(?=[=;\]}\n])/,
beginCaptures: {
"1": {
name: "storage.type.typst",
@ -912,7 +913,7 @@ const ifStatement = (): textmate.Grammar => {
const ifStatement: textmate.Pattern = {
name: "meta.expr.if.typst",
begin: lookAhead(/(else\s+)?(if\b(?!-))/),
end: /(?<=\}|\])(?!\s*else\b(?!-))/,
end: /(?<=\}|\])(?!\s*else\b(?!-))|(?=[;\}\]\)\n]|$)/,
patterns: [
/// Matches any comments
{
@ -946,7 +947,7 @@ const ifStatement = (): textmate.Grammar => {
const ifClause: textmate.Pattern = {
// name: "meta.if.clause.typst",
begin: /(?:(\belse)\s+)?(\bif)\s+/,
end: /(?<!(?:if|and|or|not|in|!=|==|<=|>=|<|>|\+|-|\*|\/|=|\+=|-=|\*=|\/=)\s+)(?=[\[\{])|(?=[;\]}]|$)/,
end: /(?<!(?:if|and|or|not|in|!=|==|<=|>=|<|>|\+|-|\*|\/|=|\+=|-=|\*=|\/=)\s*)(?=[\[\{\n])|(?=[;\n\]}]|$)/,
beginCaptures: {
"1": {
name: "keyword.control.conditional.typst",
@ -1028,7 +1029,7 @@ const forStatement = (): textmate.Grammar => {
const forStatement: textmate.Pattern = {
name: "meta.expr.for.typst",
begin: lookAhead(/(for\b(?!-))\s*/),
end: /(?<=[\}\]])(?=\s*[\n\S;\}\]\)])(?!\s*[\{\[])/,
end: /(?<=[\}\]])(?=\s*[\n\S;\}\]\)])(?!\s*[\{\[])|(?=[;\}\]\)\n]|$)/,
patterns: [
/// Matches any comments
{
@ -1055,7 +1056,7 @@ const forStatement = (): textmate.Grammar => {
begin: new RegExp(
/(for\b)\s*/.source + `(${BRACE_FREE_EXPR}|${CODE_BLOCK})\\s*(in)\\s*`
),
end: /(?=[;{\[\}\]\)]|$)/,
end: /(?=[;{\[\}\]\)\n]|$)/,
beginCaptures: {
"1": {
name: "keyword.control.loop.typst",
@ -1113,7 +1114,7 @@ const whileStatement = (): textmate.Grammar => {
const whileStatement: textmate.Pattern = {
name: "meta.expr.while.typst",
begin: lookAhead(/(while\b(?!-))/),
end: /(?<=\}|\])/,
end: /(?<=\}|\])|(?=[;\}\]\)\n]|$)/,
patterns: [
/// Matches any comments
{
@ -1137,7 +1138,7 @@ const whileStatement = (): textmate.Grammar => {
const whileClause: textmate.Pattern = {
// name: "meta.while.clause.bind.typst",
begin: /(while\b)\s*/,
end: /(?<!(?:if|and|or|not|in|!=|==|<=|>=|<|>|\+|-|\*|\/|=|\+=|-=|\*=|\/=)\s+)(?=[\[\{])|(?=[;\}\]\)]|$)/,
end: /(?<!(?:if|and|or|not|in|!=|==|<=|>=|<|>|\+|-|\*|\/|=|\+=|-=|\*=|\/=)\s+)(?=[\[\{])|(?=[;\}\]\)\n]|$)/,
beginCaptures: {
"1": {
name: "keyword.control.loop.typst",
@ -1290,7 +1291,7 @@ const showStatement = (): textmate.Grammar => {
const showSelectClause: textmate.Pattern = {
// name: "meta.show.clause.select.typst",
begin: /(show\b)\s*/,
end: /(?=[:;\}\]])/,
end: /(?=[:;\}\]\n])/,
beginCaptures: {
"1": {
name: "keyword.control.other.typst",

View file

@ -1,15 +1,15 @@
>#for i
#^ source.typst keyword.control.hash.typst
# ^^^^^^ source.typst meta.expr.for.typst
# ^^^^^ source.typst meta.expr.for.typst
>#for i in
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.for.typst
# ^^ source.typst meta.expr.for.typst keyword.operator.range.typst
>#for i in range(1)
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
@ -21,7 +21,7 @@
# ^ source.typst meta.expr.for.typst meta.expr.call.typst constant.numeric.integer.typst
# ^ source.typst meta.expr.for.typst meta.expr.call.typst meta.brace.round.typst
>#for i in range(1) []
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst

View file

@ -1,15 +1,15 @@
>#for i
#^ source.typst keyword.control.hash.typst
# ^^^^^^ source.typst meta.expr.for.typst
# ^^^^^ source.typst meta.expr.for.typst
>#for i in
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.for.typst
# ^^ source.typst meta.expr.for.typst keyword.operator.range.typst
>#for i in range(1)
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
@ -21,7 +21,7 @@
# ^ source.typst meta.expr.for.typst meta.expr.call.typst constant.numeric.integer.typst
# ^ source.typst meta.expr.for.typst meta.expr.call.typst meta.brace.round.typst
>#for i in range(1) {}
#^ source.typst meta.expr.for.typst
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst

View file

@ -4,7 +4,7 @@
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst constant.numeric.integer.typst
>#if [] 1
#^ source.typst meta.expr.if.typst
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -12,7 +12,7 @@
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst constant.numeric.integer.typst
>#if [] else [] 1
#^ source.typst meta.expr.if.typst
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst

View file

@ -4,7 +4,7 @@
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst constant.numeric.integer.typst
>#if {} 1
#^ source.typst meta.expr.if.typst
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -12,7 +12,7 @@
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst constant.numeric.integer.typst
>#if {} else {} 1
#^ source.typst meta.expr.if.typst
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -594,7 +594,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -611,7 +611,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -626,7 +626,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -641,7 +641,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -658,7 +658,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -673,7 +673,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -688,7 +688,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -705,7 +705,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -720,7 +720,7 @@
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -733,7 +733,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -747,7 +747,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -759,7 +759,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
@ -771,7 +771,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -785,7 +785,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -797,7 +797,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
# ^ source.typst meta.expr.if.typst meta.brace.square.typst
@ -809,7 +809,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -823,7 +823,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
@ -835,7 +835,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst

View file

@ -2,12 +2,12 @@
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
>#while i
#^ source.typst meta.expr.while.typst
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
# ^ source.typst meta.expr.while.typst
# ^ source.typst meta.expr.while.typst variable.other.readwrite.typst
>#while i {}
#^ source.typst meta.expr.while.typst
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
# ^ source.typst meta.expr.while.typst
# ^ source.typst meta.expr.while.typst variable.other.readwrite.typst

View file

@ -0,0 +1,3 @@
#for
test

View file

@ -0,0 +1,6 @@
>#for
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#for i
test

View file

@ -0,0 +1,6 @@
>#for i
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.for.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#for i in
test

View file

@ -0,0 +1,11 @@
>#for i in
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.for.typst
# ^^ source.typst meta.expr.for.typst keyword.operator.range.typst
# ^^ source.typst meta.expr.for.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#for i in ()
test

View file

@ -0,0 +1,13 @@
>#for i in ()
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.for.typst keyword.control.loop.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.for.typst
# ^^ source.typst meta.expr.for.typst keyword.operator.range.typst
# ^ source.typst meta.expr.for.typst
# ^ source.typst meta.expr.for.typst meta.brace.round.typst
# ^ source.typst meta.expr.for.typst meta.brace.round.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#{for}
test

View file

@ -0,0 +1,8 @@
>#{for}
#^ source.typst keyword.control.hash.typst
# ^ source.typst meta.brace.curly.typst
# ^^^ source.typst meta.expr.for.typst
# ^ source.typst meta.brace.curly.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,4 @@
#if
test #a

View file

@ -0,0 +1,10 @@
>
>#if
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
>
>test #a
#^^^^^ source.typst
# ^ source.typst variable.other.readwrite.hash.typst
# ^ source.typst variable.other.readwrite.typst
>

View file

@ -0,0 +1,4 @@
#if a
test #a

View file

@ -0,0 +1,12 @@
>
>#if a
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst variable.other.readwrite.typst
>
>test #a
#^^^^^ source.typst
# ^ source.typst variable.other.readwrite.hash.typst
# ^ source.typst variable.other.readwrite.typst
>

View file

@ -0,0 +1,3 @@
#{if}
test

View file

@ -0,0 +1,8 @@
>#{if}
#^ source.typst keyword.control.hash.typst
# ^ source.typst meta.brace.curly.typst
# ^^ source.typst meta.expr.if.typst
# ^ source.typst meta.brace.curly.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#{if () {} else}
test

View file

@ -0,0 +1,15 @@
>#{if () {} else}
#^ source.typst keyword.control.hash.typst
# ^ source.typst meta.brace.curly.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst meta.brace.round.typst
# ^ source.typst meta.expr.if.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^ source.typst meta.expr.if.typst meta.brace.curly.typst
# ^^^^^ source.typst meta.expr.if.typst
# ^ source.typst meta.brace.curly.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,4 @@
#let f()
test

View file

@ -0,0 +1,12 @@
>
>#let f()
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.let.typst storage.type.typst
# ^ source.typst meta.expr.let.typst
# ^ source.typst meta.expr.let.typst entity.name.function.typst
# ^ source.typst meta.expr.let.typst meta.brace.round.typst
# ^ source.typst meta.expr.let.typst meta.brace.round.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#let
test

View file

@ -0,0 +1,8 @@
>
>#let
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.let.typst storage.type.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#let f
test

View file

@ -0,0 +1,10 @@
>
>#let f
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.let.typst storage.type.typst
# ^ source.typst meta.expr.let.typst
# ^ source.typst meta.expr.let.typst variable.other.readwrite.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show
test

View file

@ -0,0 +1,8 @@
>
>#show
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show:
test

View file

@ -0,0 +1,9 @@
>
>#show:
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
# ^ source.typst meta.expr.show.typst punctuation.separator.colon.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show text
test

View file

@ -0,0 +1,10 @@
>
>#show text
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
# ^ source.typst meta.expr.show.typst
# ^^^^ source.typst meta.expr.show.typst variable.other.readwrite.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show text.
test

View file

@ -0,0 +1,11 @@
>
>#show text.
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
# ^ source.typst meta.expr.show.typst
# ^^^^ source.typst meta.expr.show.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.show.typst keyword.operator.accessor.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show text.where
test

View file

@ -0,0 +1,12 @@
>
>#show text.where
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
# ^ source.typst meta.expr.show.typst
# ^^^^ source.typst meta.expr.show.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.show.typst keyword.operator.accessor.typst
# ^^^^^ source.typst meta.expr.show.typst variable.other.readwrite.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,4 @@
#show text.where()
test

View file

@ -0,0 +1,14 @@
>
>#show text.where()
#^ source.typst keyword.control.hash.typst
# ^^^^ source.typst meta.expr.show.typst keyword.control.other.typst
# ^ source.typst meta.expr.show.typst
# ^^^^ source.typst meta.expr.show.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.show.typst meta.expr.call.typst keyword.operator.accessor.typst
# ^^^^^ source.typst meta.expr.show.typst meta.expr.call.typst entity.name.function.typst
# ^ source.typst meta.expr.show.typst meta.expr.call.typst meta.brace.round.typst
# ^ source.typst meta.expr.show.typst meta.expr.call.typst meta.brace.round.typst
>
>test
#^^^^^ source.typst
>

View file

@ -0,0 +1,3 @@
#while
test

View file

@ -0,0 +1,6 @@
>#while
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#while i
test

View file

@ -0,0 +1,8 @@
>#while i
#^ source.typst keyword.control.hash.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
# ^ source.typst meta.expr.while.typst
# ^ source.typst meta.expr.while.typst variable.other.readwrite.typst
>
>test
#^^^^^ source.typst

View file

@ -0,0 +1,3 @@
#{while}
test

View file

@ -0,0 +1,8 @@
>#{while}
#^ source.typst keyword.control.hash.typst
# ^ source.typst meta.brace.curly.typst
# ^^^^^ source.typst meta.expr.while.typst keyword.control.loop.typst
# ^ source.typst meta.brace.curly.typst
>
>test
#^^^^^ source.typst

View file

@ -4,7 +4,7 @@
# ^ source.typst meta.expr.if.typst
# ^^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -14,7 +14,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -42,7 +42,7 @@
# ^ source.typst meta.expr.if.typst
# ^^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -55,7 +55,7 @@
# ^ source.typst meta.expr.if.typst
# ^^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -65,7 +65,7 @@
#^ source.typst keyword.control.hash.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -76,7 +76,7 @@
# ^ source.typst meta.expr.if.typst
# ^^ source.typst meta.expr.if.typst keyword.control.conditional.typst
# ^ source.typst meta.expr.if.typst
# ^^^ source.typst meta.expr.if.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.if.typst keyword.other.logical.typst
# ^ source.typst meta.expr.if.typst
# ^^^^ source.typst meta.expr.if.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.if.typst
@ -121,7 +121,7 @@
# ^ source.typst meta.expr.while.typst
# ^^^^^ source.typst meta.expr.while.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.while.typst
# ^^^ source.typst meta.expr.while.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.while.typst keyword.other.logical.typst
# ^ source.typst meta.expr.while.typst
# ^^^^ source.typst meta.expr.while.typst entity.name.type.primitive.typst
# ^ source.typst meta.expr.while.typst
@ -157,7 +157,7 @@
# ^ source.typst meta.expr.set.typst
# ^^^^^ source.typst meta.expr.set.typst entity.name.type.primitive.typst
# ^^^ source.typst meta.expr.set.typst
# ^^^ source.typst meta.expr.set.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.set.typst keyword.other.logical.typst
# ^^^^ source.typst meta.expr.set.typst
# ^^^^ source.typst meta.expr.set.typst entity.name.type.primitive.typst
>#set text(red) if not true
@ -171,7 +171,7 @@
# ^ source.typst meta.expr.set.typst
# ^^ source.typst meta.expr.set.typst keyword.control.conditional.typst
# ^^^ source.typst meta.expr.set.typst
# ^^^ source.typst meta.expr.set.typst keyword.operator.logical.typst
# ^^^ source.typst meta.expr.set.typst keyword.other.logical.typst
# ^^^^^^^^^^ source.typst meta.expr.set.typst
# ^^^^ source.typst meta.expr.set.typst entity.name.type.primitive.typst
>

View file

@ -5,7 +5,7 @@
#^^ source.typst
# ^^^^^ source.typst entity.name.type.primitive.typst
# ^^^^^^^^^^^^^^^^^^^ source.typst
# ^^^ source.typst keyword.operator.logical.typst
# ^^^ source.typst keyword.other.logical.typst
# ^^^^^^^^^^^ source.typst
# ^^^^ source.typst entity.name.type.primitive.typst
# ^ source.typst punctuation.separator.colon.typst
@ -68,7 +68,7 @@
# ^^^^^ source.typst meta.expr.set.typst entity.name.type.primitive.typst
> and true
#^^ source.typst
# ^^^ source.typst keyword.operator.logical.typst
# ^^^ source.typst keyword.other.logical.typst
# ^ source.typst
# ^^^^ source.typst entity.name.type.primitive.typst
>}

View file

@ -54,12 +54,12 @@
# ^ source.typst meta.brace.round.typst
>#not a
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst keyword.operator.logical.typst
# ^^^ source.typst keyword.other.logical.typst
# ^^^ source.typst
>#(not a)
#^ source.typst keyword.control.hash.typst
# ^ source.typst meta.brace.round.typst
# ^^^ source.typst keyword.operator.logical.typst
# ^^^ source.typst keyword.other.logical.typst
# ^ source.typst
# ^ source.typst variable.other.readwrite.typst
# ^ source.typst meta.brace.round.typst
@ -68,7 +68,7 @@
# ^ source.typst meta.brace.round.typst
# ^ source.typst variable.other.readwrite.typst
# ^ source.typst
# ^^^ source.typst keyword.operator.logical.typst
# ^^^ source.typst keyword.other.logical.typst
# ^ source.typst
# ^^^ source.typst support.type.builtin.typst
# ^ source.typst meta.brace.round.typst
@ -77,7 +77,7 @@
# ^ source.typst meta.brace.round.typst
# ^ source.typst variable.other.readwrite.typst
# ^ source.typst
# ^^ source.typst keyword.operator.logical.typst
# ^^ source.typst keyword.other.logical.typst
# ^ source.typst
# ^^^ source.typst support.type.builtin.typst
# ^ source.typst meta.brace.round.typst