This commit is contained in:
2026-06-10 03:18:19 +02:00
parent 988f041e77
commit ea3dbef22d
+296 -87
View File
@@ -1,31 +1,77 @@
{ {
"$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": "#strings" }, "include": "#comments"
{ "include": "#attributes" }, },
{ "include": "#macros" }, {
{ "include": "#type_declarations" }, "include": "#strings"
{ "include": "#keywords" }, },
{ "include": "#numbers" }, {
{ "include": "#lifetimes" }, "include": "#attributes"
{ "include": "#generics" }, },
{ "include": "#types" }, {
{ "include": "#namespaces" }, "include": "#macros"
{ "include": "#imports" }, },
{ "include": "#modules" }, {
{ "include": "#struct_literals" }, "include": "#type_declarations"
{ "include": "#method_calls" }, },
{ "include": "#field_access" }, {
{ "include": "#arrow" }, "include": "#keywords"
{ "include": "#return_arrow" }, },
{ "include": "#functions" }, {
{ "include": "#path_continuation" }, "include": "#numbers"
{ "include": "#operators" }, },
{ "include": "#punctuation" }, {
{ "include": "#variables" } "include": "#lifetimes"
},
{
"include": "#generics"
},
{
"include": "#types"
},
{
"include": "#namespaces"
},
{
"include": "#imports"
},
{
"include": "#modules"
},
{
"include": "#struct_literals"
},
{
"include": "#method_calls"
},
{
"include": "#field_access"
},
{
"include": "#arrow"
},
{
"include": "#return_arrow"
},
{
"include": "#functions"
},
{
"include": "#path_continuation"
},
{
"include": "#operators"
},
{
"include": "#punctuation"
},
{
"include": "#variables"
}
], ],
"repository": { "repository": {
"comments": { "comments": {
@@ -35,55 +81,120 @@
"strings": { "strings": {
"name": "string.quoted.double.mist", "name": "string.quoted.double.mist",
"begin": "\"", "begin": "\"",
"beginCaptures": { "0": { "name": "punctuation.definition.string.begin.mist" } }, "beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.mist"
}
},
"end": "\"", "end": "\"",
"endCaptures": { "0": { "name": "punctuation.definition.string.end.mist" } }, "endCaptures": {
"0": {
"name": "punctuation.definition.string.end.mist"
}
},
"patterns": [ "patterns": [
{ "match": "\\\\.", "name": "constant.character.escape.mist" } {
"match": "\\\\.",
"name": "constant.character.escape.mist"
}
] ]
}, },
"attributes": { "attributes": {
"name": "meta.attribute.mist", "name": "meta.attribute.mist",
"begin": "#!?\\[", "begin": "#!?\\[",
"beginCaptures": { "0": { "name": "punctuation.definition.attribute.begin.mist" } }, "beginCaptures": {
"0": {
"name": "punctuation.definition.attribute.begin.mist"
}
},
"end": "\\]", "end": "\\]",
"endCaptures": { "0": { "name": "punctuation.definition.attribute.end.mist" } }, "endCaptures": {
"patterns": [{ "include": "$self" }] "0": {
"name": "punctuation.definition.attribute.end.mist"
}
},
"patterns": [
{
"include": "$self"
}
]
}, },
"macros": { "macros": {
"patterns": [ "patterns": [
{ {
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\()", "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\()",
"beginCaptures": { "beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" }, "1": {
"2": { "name": "keyword.operator.macro.mist" }, "name": "entity.name.function.macro.mist"
"3": { "name": "punctuation.parenthesis.begin.mist" } },
"2": {
"name": "keyword.operator.macro.mist"
},
"3": {
"name": "punctuation.parenthesis.begin.mist"
}
}, },
"end": "\\)", "end": "\\)",
"endCaptures": { "0": { "name": "punctuation.parenthesis.end.mist" } }, "endCaptures": {
"patterns": [{ "include": "$self" }] "0": {
"name": "punctuation.parenthesis.end.mist"
}
},
"patterns": [
{
"include": "$self"
}
]
}, },
{ {
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\[)", "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\[)",
"beginCaptures": { "beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" }, "1": {
"2": { "name": "keyword.operator.macro.mist" }, "name": "entity.name.function.macro.mist"
"3": { "name": "punctuation.bracket.begin.mist" } },
"2": {
"name": "keyword.operator.macro.mist"
},
"3": {
"name": "punctuation.bracket.begin.mist"
}
}, },
"end": "\\]", "end": "\\]",
"endCaptures": { "0": { "name": "punctuation.bracket.end.mist" } }, "endCaptures": {
"patterns": [{ "include": "$self" }] "0": {
"name": "punctuation.bracket.end.mist"
}
},
"patterns": [
{
"include": "$self"
}
]
}, },
{ {
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\{)", "begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(!)(\\{)",
"beginCaptures": { "beginCaptures": {
"1": { "name": "entity.name.function.macro.mist" }, "1": {
"2": { "name": "keyword.operator.macro.mist" }, "name": "entity.name.function.macro.mist"
"3": { "name": "punctuation.curly.brace.begin.mist" } },
"2": {
"name": "keyword.operator.macro.mist"
},
"3": {
"name": "punctuation.curly.brace.begin.mist"
}
}, },
"end": "\\}", "end": "\\}",
"endCaptures": { "0": { "name": "punctuation.curly.brace.end.mist" } }, "endCaptures": {
"patterns": [{ "include": "$self" }] "0": {
"name": "punctuation.curly.brace.end.mist"
}
},
"patterns": [
{
"include": "$self"
}
]
} }
] ]
}, },
@@ -92,31 +203,57 @@
{ {
"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": { "name": "storage.type.mist" }, "1": {
"2": { "name": "entity.name.type.mist" } "name": "storage.type.mist"
},
"2": {
"name": "entity.name.type.mist"
}
} }
}, },
{ {
"match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", "match": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": { "captures": {
"1": { "name": "storage.type.mist" }, "1": {
"2": { "name": "entity.name.function.mist" } "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(struct|enum|class|trait|fn|let|impl|class)\\b", "name": "storage.modifier.mist" }, "match": "\\b(if|else|while|for|return|break|continue|match|loop)\\b",
{ "match": "\\b(pub|mut|use|mod|as|dyn|unsafe|self|constructor)\\b", "name": "keyword.other.mist" }, "name": "keyword.control.mist"
{ "match": "\\b(true|false)\\b", "name": "constant.language.boolean.mist" } },
{
"match": "\\b(struct|enum|class|trait|fn|let|impl|class)\\b",
"name": "storage.modifier.mist"
},
{
"match": "\\b(pub|mut|use|mod|as|dyn|unsafe|self|super|Super|constructor|override)\\b",
"name": "keyword.other.mist"
},
{
"match": "\\b(true|false)\\b",
"name": "constant.language.boolean.mist"
}
] ]
}, },
"numbers": { "numbers": {
"patterns": [ "patterns": [
{ "match": "\\b\\d+\\.\\d+\\b", "name": "constant.numeric.float.mist" }, {
{ "match": "\\b\\d+\\b", "name": "constant.numeric.integer.mist" } "match": "\\b\\d+\\.\\d+\\b",
"name": "constant.numeric.float.mist"
},
{
"match": "\\b\\d+\\b",
"name": "constant.numeric.integer.mist"
}
] ]
}, },
"lifetimes": { "lifetimes": {
@@ -127,20 +264,51 @@
"patterns": [ "patterns": [
{ {
"begin": "(?<=[a-zA-Z0-9_>])<(?![=<>])", "begin": "(?<=[a-zA-Z0-9_>])<(?![=<>])",
"beginCaptures": { "0": { "name": "punctuation.brackets.angle.mist" } }, "beginCaptures": {
"0": {
"name": "punctuation.brackets.angle.mist"
}
},
"end": "(?<!=)>", "end": "(?<!=)>",
"endCaptures": { "0": { "name": "punctuation.brackets.angle.mist" } }, "endCaptures": {
"0": {
"name": "punctuation.brackets.angle.mist"
}
},
"patterns": [ "patterns": [
{ "include": "#comments" }, {
{ "include": "#strings" }, "include": "#comments"
{ "include": "#lifetimes" }, },
{ "include": "#types" }, {
{ "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b", "name": "entity.name.type.mist" }, "include": "#strings"
{ "match": ",", "name": "punctuation.separator.mist" }, },
{ "match": "[:+]", "name": "keyword.operator.mist" }, {
{ "include": "#field_access" }, "include": "#lifetimes"
{ "include": "#path_continuation" }, },
{ "include": "#generics" } {
"include": "#types"
},
{
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b",
"name": "entity.name.type.mist"
},
{
"match": ",",
"name": "punctuation.separator.mist"
},
{
"match": "[:+]",
"name": "keyword.operator.mist"
},
{
"include": "#field_access"
},
{
"include": "#path_continuation"
},
{
"include": "#generics"
}
] ]
} }
] ]
@@ -164,20 +332,26 @@
"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": { "name": "entity.name.namespace.mist" } "1": {
"name": "entity.name.namespace.mist"
}
} }
}, },
"imports": { "imports": {
"match": "\\buse\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:\\s*::\\s*[a-zA-Z_][a-zA-Z0-9_]*)*)\\s*;", "match": "\\buse\\s+([a-zA-Z_][a-zA-Z0-9_]*(?:\\s*::\\s*[a-zA-Z_][a-zA-Z0-9_]*)*)\\s*;",
"captures": { "captures": {
"1": { "name": "entity.name.namespace.mist" } "1": {
"name": "entity.name.namespace.mist"
}
}, },
"name": "meta.import.mist" "name": "meta.import.mist"
}, },
"modules": { "modules": {
"match": "(?:pub\\s+)?\\bmod\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;", "match": "(?:pub\\s+)?\\bmod\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
"captures": { "captures": {
"1": { "name": "entity.name.namespace.module.mist" } "1": {
"name": "entity.name.namespace.module.mist"
}
} }
}, },
"struct_literals": { "struct_literals": {
@@ -185,22 +359,51 @@
{ {
"begin": "\\b([A-Z][a-zA-Z0-9_]*)\\s*(\\{)", "begin": "\\b([A-Z][a-zA-Z0-9_]*)\\s*(\\{)",
"beginCaptures": { "beginCaptures": {
"1": { "name": "entity.name.type.mist" }, "1": {
"2": { "name": "punctuation.curly.brace.begin.mist" } "name": "entity.name.type.mist"
},
"2": {
"name": "punctuation.curly.brace.begin.mist"
}
}, },
"end": "\\}", "end": "\\}",
"endCaptures": { "0": { "name": "punctuation.curly.brace.end.mist" } }, "endCaptures": {
"0": {
"name": "punctuation.curly.brace.end.mist"
}
},
"patterns": [ "patterns": [
{ "include": "#strings" }, {
{ "include": "#numbers" }, "include": "#strings"
{ "include": "#keywords" }, },
{ "include": "#lifetimes" }, {
{ "include": "#types" }, "include": "#numbers"
{ "include": "#operators" }, },
{ "include": "#punctuation" }, {
{ "include": "#field_access" }, "include": "#keywords"
{ "match": "[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=:)", "name": "variable.object.field.mist" }, },
{ "include": "$self" } {
"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"
}
] ]
} }
] ]
@@ -208,19 +411,25 @@
"method_calls": { "method_calls": {
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()", "match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
"captures": { "captures": {
"1": { "name": "entity.name.function.mist" } "1": {
"name": "entity.name.function.mist"
}
} }
}, },
"field_access": { "field_access": {
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\b", "match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"captures": { "captures": {
"1": { "name": "variable.other.property.mist" } "1": {
"name": "variable.other.property.mist"
}
} }
}, },
"path_continuation": { "path_continuation": {
"match": "::\\s*([a-zA-Z_][a-zA-Z0-9_]*+)(?!\\s*\\()", "match": "::\\s*([a-zA-Z_][a-zA-Z0-9_]*+)(?!\\s*\\()",
"captures": { "captures": {
"1": { "name": "entity.name.namespace.mist" } "1": {
"name": "entity.name.namespace.mist"
}
} }
}, },
"arrow": { "arrow": {
@@ -252,4 +461,4 @@
"name": "variable.other.mist" "name": "variable.other.mist"
} }
} }
} }