Updated syntax highlighting

This commit is contained in:
2026-06-10 03:12:48 +02:00
parent c6ddf7a098
commit a200e66774
+183 -158
View File
@@ -1,181 +1,147 @@
{ {
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "mist", "name": "Mist",
"scopeName": "source.mist", "scopeName": "source.mist",
"patterns": [ "patterns": [
{ { "include": "#comments" },
"include": "#comments" { "include": "#strings" },
}, { "include": "#attributes" },
{ { "include": "#macros" },
"include": "#keywords" { "include": "#type_declarations" },
}, { "include": "#keywords" },
{ { "include": "#numbers" },
"include": "#attributes" { "include": "#lifetimes" },
}, { "include": "#generics" },
{ { "include": "#types" },
"include": "#strings" { "include": "#namespaces" },
}, { "include": "#imports" },
{ { "include": "#modules" },
"include": "#macros" { "include": "#struct_literals" },
}, { "include": "#method_calls" },
{ { "include": "#field_access" },
"include": "#type_declarations" { "include": "#arrow" },
}, { "include": "#return_arrow" },
{ { "include": "#functions" },
"include": "#constants" { "include": "#path_continuation" },
}, { "include": "#operators" },
{ { "include": "#punctuation" },
"include": "#lifetimes" { "include": "#variables" }
},
{
"include": "#generics"
},
{
"include": "#types"
},
{
"include": "#namespaces"
},
{
"include": "#functions"
},
{
"include": "#numbers"
},
{
"include": "#operators"
},
{
"include": "#punctuation"
}
], ],
"repository": { "repository": {
"comments": { "comments": {
"match": "//.*", "name": "comment.line.double-slash.mist",
"name": "comment.line.double-slash.mist" "match": "//.*"
},
"attributes": {
"begin": "#!?\\[",
"beginCaptures": {
"0": {
"name": "punctuation.definition.attribute.begin.mist"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.definition.attribute.end.mist"
}
},
"name": "meta.attribute.mist",
"patterns": [
{
"include": "$self"
}
]
}, },
"strings": { "strings": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.mist"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.mist"
}
},
"name": "string.quoted.double.mist", "name": "string.quoted.double.mist",
"begin": "\"",
"beginCaptures": { "0": { "name": "punctuation.definition.string.begin.mist" } },
"end": "\"",
"endCaptures": { "0": { "name": "punctuation.definition.string.end.mist" } },
"patterns": [
{ "match": "\\\\.", "name": "constant.character.escape.mist" }
]
},
"attributes": {
"name": "meta.attribute.mist",
"begin": "#!?\\[",
"beginCaptures": { "0": { "name": "punctuation.definition.attribute.begin.mist" } },
"end": "\\]",
"endCaptures": { "0": { "name": "punctuation.definition.attribute.end.mist" } },
"patterns": [{ "include": "$self" }]
},
"macros": {
"patterns": [ "patterns": [
{ {
"match": "\\\\.", "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\()",
"name": "constant.character.escape.mist" "beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" },
"2": { "name": "keyword.operator.macro.mist" },
"3": { "name": "punctuation.parenthesis.begin.mist" }
},
"end": "\\)",
"endCaptures": { "0": { "name": "punctuation.parenthesis.end.mist" } },
"patterns": [{ "include": "$self" }]
},
{
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\[)",
"beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" },
"2": { "name": "keyword.operator.macro.mist" },
"3": { "name": "punctuation.bracket.begin.mist" }
},
"end": "\\]",
"endCaptures": { "0": { "name": "punctuation.bracket.end.mist" } },
"patterns": [{ "include": "$self" }]
},
{
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\{)",
"beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" },
"2": { "name": "keyword.operator.macro.mist" },
"3": { "name": "punctuation.curly.brace.begin.mist" }
},
"end": "\\}",
"endCaptures": { "0": { "name": "punctuation.curly.brace.end.mist" } },
"patterns": [{ "include": "$self" }]
} }
] ]
}, },
"macros": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)",
"captures": {
"1": {
"name": "entity.name.function.macro.mist"
},
"2": {
"name": "keyword.operator.macro.mist"
}
}
},
"type_declarations": { "type_declarations": {
"patterns": [
{
"match": "\\b(struct|enum|class|trait)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", "match": "\\b(struct|enum|class|trait)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": { "captures": {
"1": { "1": { "name": "storage.type.mist" },
"name": "storage.type.mist" "2": { "name": "entity.name.type.mist" }
}
}, },
"2": { {
"name": "entity.name.type.mist" "match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": { "name": "storage.type.mist" },
"2": { "name": "entity.name.function.mist" }
} }
} }
]
}, },
"keywords": { "keywords": {
"patterns": [ "patterns": [
{ { "match": "\\b(if|else|while|for|return|break|continue|match|loop)\\b", "name": "keyword.control.mist" },
"match": "\\b(if|else|while|for|in|return|break|continue|match)\\b", { "match": "\\b(struct|enum|class|trait|fn|let|impl|class)\\b", "name": "storage.modifier.mist" },
"name": "keyword.control.mist" { "match": "\\b(pub|mut|use|mod|as|dyn|unsafe|self|constructor|override)\\b", "name": "keyword.other.mist" },
}, { "match": "\\b(true|false)\\b", "name": "constant.language.boolean.mist" }
{
"match": "\\b(struct|enum|class|trait|var)\\b",
"name": "storage.type.mist"
},
{
"match": "\\b(pub|mut|constructor)\\b",
"name": "storage.modifier.mist"
},
{
"match": "\\b(impl|use|mod|new|void|self)\\b",
"name": "keyword.other.mist"
}
] ]
}, },
"constants": { "numbers": {
"match": "\\b(true|false)\\b", "patterns": [
"name": "constant.language.boolean.mist" { "match": "\\b\\d+\\.\\d+\\b", "name": "constant.numeric.float.mist" },
{ "match": "\\b\\d+\\b", "name": "constant.numeric.integer.mist" }
]
}, },
"lifetimes": { "lifetimes": {
"match": "'[a-zA-Z_][a-zA-Z0-9_]*\\b", "match": "'[a-zA-Z_][a-zA-Z0-9_]*\\b",
"name": "storage.modifier.lifetime.mist" "name": "storage.modifier.lifetime.mist"
}, },
"generics": { "generics": {
"begin": "<",
"beginCaptures": {
"0": {
"name": "punctuation.brackets.angle.mist"
}
},
"end": ">",
"endCaptures": {
"0": {
"name": "punctuation.brackets.angle.mist"
}
},
"patterns": [ "patterns": [
{ {
"include": "#lifetimes" "begin": "(?<=[a-zA-Z0-9_>])<(?![=<>])",
}, "beginCaptures": { "0": { "name": "punctuation.brackets.angle.mist" } },
{ "end": "(?<!=)>",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b", "endCaptures": { "0": { "name": "punctuation.brackets.angle.mist" } },
"name": "entity.name.type.mist" "patterns": [
}, { "include": "#comments" },
{ { "include": "#strings" },
"match": ",", { "include": "#lifetimes" },
"name": "punctuation.separator.mist" { "include": "#types" },
}, { "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b", "name": "entity.name.type.mist" },
{ { "match": ",", "name": "punctuation.separator.mist" },
"match": ":|\\+", { "match": "[:+]", "name": "keyword.operator.mist" },
"name": "keyword.operator.mist" { "include": "#field_access" },
}, { "include": "#path_continuation" },
{ { "include": "#generics" }
"include": "#generics" ]
} }
] ]
}, },
@@ -198,34 +164,93 @@
"namespaces": { "namespaces": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*::)", "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*::)",
"captures": { "captures": {
"1": { "1": { "name": "entity.name.namespace.mist" }
"name": "entity.name.namespace.mist"
} }
},
"imports": {
"match": "\\buse\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:\\s*::\\s*[a-zA-Z_][a-zA-Z0-9_]*)*)\\s*;",
"captures": {
"1": { "name": "entity.name.namespace.mist" }
},
"name": "meta.import.mist"
},
"modules": {
"match": "(?:pub\\s+)?\\bmod\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
"captures": {
"1": { "name": "entity.name.namespace.module.mist" }
} }
}, },
"struct_literals": {
"patterns": [
{
"begin": "\\b([A-Z][a-zA-Z0-9_]*)\\s*(\\{)",
"beginCaptures": {
"1": { "name": "entity.name.type.mist" },
"2": { "name": "punctuation.curly.brace.begin.mist" }
},
"end": "\\}",
"endCaptures": { "0": { "name": "punctuation.curly.brace.end.mist" } },
"patterns": [
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#keywords" },
{ "include": "#lifetimes" },
{ "include": "#types" },
{ "include": "#operators" },
{ "include": "#punctuation" },
{ "include": "#field_access" },
{ "match": "[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=:)", "name": "variable.object.field.mist" },
{ "include": "$self" }
]
}
]
},
"method_calls": {
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
"captures": {
"1": { "name": "entity.name.function.mist" }
}
},
"field_access": {
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"captures": {
"1": { "name": "variable.other.property.mist" }
}
},
"path_continuation": {
"match": "::\\s*([a-zA-Z_][a-zA-Z0-9_]*+)(?!\\s*\\()",
"captures": {
"1": { "name": "entity.name.namespace.mist" }
}
},
"arrow": {
"match": "=>",
"name": "keyword.operator.arrow.mist"
},
"return_arrow": {
"match": "->",
"name": "keyword.operator.arrow.mist"
},
"functions": { "functions": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()", "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
"name": "entity.name.function.mist" "name": "entity.name.function.mist"
}, },
"numbers": { "operators": {
"patterns": [ "patterns": [
{ {
"match": "\\b\\d+\\.\\d+\\b", "match": "(?:\\+=|-=|\\*=|\\/=|%=|&=|\\|=|\\^=|<<=|>>=|<<|>>|\\.\\.=|\\.\\.|<=|>=|==|!=|&&|\\|\\||[+\\-*/%<>&|^=!]|\\+\\+|--)",
"name": "constant.numeric.float.mist" "name": "keyword.operator.mist"
},
{
"match": "\\b\\d+\\b",
"name": "constant.numeric.integer.mist"
} }
] ]
}, },
"operators": {
"match": "(<=|>=|==|!=|&&|\\|\\||\\+|-|\\*|/|%|<|>|=|=>|!)",
"name": "keyword.operator.mist"
},
"punctuation": { "punctuation": {
"match": "::|:|;|,|\\.|\\{|\\}|\\(|\\)|\\[|\\]", "match": "::|:|;|,|\\.|\\{|\\}|\\(|\\)|\\[|\\]|\\?",
"name": "punctuation.mist" "name": "punctuation.mist"
},
"variables": {
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b",
"name": "variable.other.mist"
} }
} }
} }