summaryrefslogtreecommitdiff
path: root/tools/support/typst.tmLanguage.json
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-06-23 19:46:04 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-23 19:46:04 +0200
commitef279fa6673ebf7aaf5bfb26354db66d6dcec302 (patch)
tree655de7909df996fd8346c8dc9d6bbb5290a9a67a /tools/support/typst.tmLanguage.json
parent62ecd31af2f79c7631e283a059916f5bfab7e69d (diff)
Improve syntax definition
- Allow both from and using for now - Remove exclamation mark support - Support with expressions to apply arguments to a function
Diffstat (limited to 'tools/support/typst.tmLanguage.json')
-rw-r--r--tools/support/typst.tmLanguage.json16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/support/typst.tmLanguage.json b/tools/support/typst.tmLanguage.json
index cdf92649..c45b8988 100644
--- a/tools/support/typst.tmLanguage.json
+++ b/tools/support/typst.tmLanguage.json
@@ -119,7 +119,7 @@
},
{
"name": "keyword.other.typst",
- "match": "(#)(in|using|as)\\b",
+ "match": "(#)(as|in|with|from|using)\\b",
"captures": { "1": { "name": "punctuation.definition.keyword.typst" } }
},
{
@@ -171,12 +171,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" }]
@@ -213,7 +213,7 @@
},
{
"name": "keyword.operator.arithmetic.typst",
- "match": "\\+|\\*!?|/|(?<![[:alpha:]_][[:alnum:]_-]*)-(?![:alnum:]_-]*[[:alpha:]_])"
+ "match": "\\+|\\*|/|(?<![[:alpha:]_][[:alnum:]_-]*)-(?![:alnum:]_-]*[[:alpha:]_])"
},
{
"name": "keyword.operator.word.typst",
@@ -221,21 +221,21 @@
},
{
"name": "keyword.control.typst",
- "match": "\\b(if|else|for|in|while|break|continue|return)\\b"
+ "match": "\\b(if|else|for|while|break|continue|return)\\b"
},
{
"name": "keyword.other.typst",
- "match": "\\b(pub|let|import|include|using|as)\\b"
+ "match": "\\b(pub|let|as|in|with|import|include|from|using)\\b"
},
{ "include": "#constants" },
{
"comment": "Function name",
"name": "entity.name.function.typst",
- "match": "\\b[[:alpha:]_][[:alnum:]_-]*!?(?=\\[|\\()"
+ "match": "\\b[[:alpha:]_][[:alnum:]_-]*(?=\\[|\\(|\\s+\\bwith\\b)"
},
{
"comment": "Function arguments",
- "begin": "(?<=\\b[[:alpha:]_][[:alnum:]_-]*!?)\\(",
+ "begin": "(?<=\\b[[:alpha:]_][[:alnum:]_-]*|\\bwith\\b\\s+)\\(",
"end": "\\)",
"captures": { "0": { "name": "punctuation.definition.group.typst" } },
"patterns": [{ "include": "#arguments" }]