From 271b0f953b35ab2c0281b5f728798204accc412f Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 17 Mar 2021 14:47:11 +0100 Subject: =?UTF-8?q?Fixes=20in=20TextMate=20grammar=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/support/typst.tmLanguage.json | 50 ++++++++----------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) (limited to 'tools/support') diff --git a/tools/support/typst.tmLanguage.json b/tools/support/typst.tmLanguage.json index 867f2109..58c9f893 100644 --- a/tools/support/typst.tmLanguage.json +++ b/tools/support/typst.tmLanguage.json @@ -114,16 +114,16 @@ }, { "name": "keyword.control.typst", - "match": "(#)(break|continue|return)", + "match": "(#)(break|continue|return)\\b", "captures": { "1": { "name": "punctuation.definition.keyword.typst" } } }, { "name": "keyword.other.typst", - "match": "(#)from", + "match": "(#)(from|in)\\b", "captures": { "1": { "name": "punctuation.definition.keyword.typst" } } }, { - "begin": "(#)pub", + "begin": "(#)(pub|let)\\b", "end": "\n|(;)|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.other.typst" }, @@ -133,26 +133,7 @@ "patterns": [{ "include": "#code" }] }, { - "begin": "(#)let", - "end": "\n|;|(?=])|(?<=}|])", - "beginCaptures": { - "0": { "name": "keyword.other.typst" }, - "1": { "name": "punctuation.definition.keyword.typst" } - }, - "endCaptures": { "1": { "name": "punctuation.terminator.statement.typst" } }, - "patterns": [{ "include": "#code" }] - }, - { - "begin": "(#)if", - "end": "\n|(?=])|(?<=}|])", - "beginCaptures": { - "0": { "name": "keyword.control.conditional.typst" }, - "1": { "name": "punctuation.definition.keyword.typst" } - }, - "patterns": [{ "include": "#code" }] - }, - { - "begin": "(#)else", + "begin": "(#)(if|else)\\b", "end": "\n|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.control.conditional.typst" }, @@ -161,16 +142,7 @@ "patterns": [{ "include": "#code" }] }, { - "begin": "(#)for", - "end": "\n|(?=])|(?<=}|])", - "beginCaptures": { - "0": { "name": "keyword.control.typst" }, - "1": { "name": "punctuation.definition.keyword.typst" } - }, - "patterns": [{ "include": "#code" }] - }, - { - "begin": "(#)while", + "begin": "(#)(for|while)\\b", "end": "\n|(?=])|(?<=}|])", "beginCaptures": { "0": { "name": "keyword.control.typst" }, @@ -179,7 +151,7 @@ "patterns": [{ "include": "#code" }] }, { - "begin": "(#)import", + "begin": "(#)import\\b", "end": "\n|(?=])", "beginCaptures": { "0": { "name": "keyword.control.import.typst" }, @@ -190,12 +162,12 @@ { "comment": "Function name", "name": "entity.name.function.typst", - "match": "((#)[[:alpha:]_][[:alnum:]_-]*)(?=\\[|\\()", + "match": "((#)[[:alpha:]_][[:alnum:]_-]*!?)(?=\\[|\\()", "captures": { "2": { "name": "punctuation.definition.function.typst" } } }, { "comment": "Function arguments", - "begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*)\\(", + "begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*!?)\\(", "end": "\\)", "captures": { "0": { "name": "punctuation.definition.group.typst" } }, "patterns": [{ "include": "#arguments" }] @@ -232,7 +204,7 @@ }, { "name": "keyword.operator.arithmetic.typst", - "match": "\\+|\\*|/|(?