Working syntax

This commit is contained in:
2026-05-13 06:36:04 +02:00
parent 2d13e07b84
commit 127829f99f
2 changed files with 194 additions and 87 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
"languages": [{ "languages": [{
"id": "mist", "id": "mist",
"aliases": ["Mist", "mist"], "aliases": ["Mist", "mist"],
"extensions": [".ms"], "extensions": [".mist"],
"configuration": "./language-configuration.json" "configuration": "./language-configuration.json"
}], }],
"grammars": [{ "grammars": [{
+193 -86
View File
@@ -1,87 +1,194 @@
{ {
"$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": "#keywords" }, "include": "#comments"
{ "include": "#strings" }, },
{ "include": "#numbers" }, {
{ "include": "#types" }, "include": "#attributes"
{ "include": "#operators" } },
], {
"repository": { "include": "#strings"
"comments": { },
"patterns": [ {
{ "include": "#macros"
"name": "comment.line.double-slash.mist", },
"match": "//.*$" {
} "include": "#type_declarations"
] },
}, {
"include": "#keywords"
"keywords": { },
"patterns": [ {
{ "include": "#constants"
"name": "keyword.control.flow.mist", },
"match": "\\b(if|else|for|return|function|class|struct|import|let|const)\\b" {
}, "include": "#lifetimes"
{ },
"name": "constant.language.null.mist", {
"match": "\\b(null)\\b" "include": "#types"
}, },
{ {
"name": "constant.language.this.mist", "include": "#namespaces"
"match": "\\b(this)\\b" },
}, {
{ "include": "#functions"
"name": "constant.language.boolean.mist", },
"match": "\\b(true|false)\\b" {
} "include": "#numbers"
] },
}, {
"include": "#operators"
"strings": { },
"name": "string.quoted.double.mist", {
"begin": "\"", "include": "#punctuation"
"end": "\"", }
"patterns": [ ],
{ "repository": {
"name": "constant.character.escape.mist", "comments": {
"match": "\\\\." "match": "//.*",
} "name": "comment.line.double-slash.mist"
] },
}, "attributes": {
"begin": "#!?\\[",
"numbers": { "beginCaptures": {
"patterns": [ "0": {
{ "name": "punctuation.definition.attribute.begin.mist"
"name": "constant.numeric.float.mist", }
"match": "\\b\\d+\\.\\d+\\b" },
}, "end": "\\]",
{ "endCaptures": {
"name": "constant.numeric.integer.mist", "0": {
"match": "\\b\\d+\\b" "name": "punctuation.definition.attribute.end.mist"
} }
] },
}, "name": "meta.attribute.mist",
"patterns": [
"types": { {
"patterns": [ "include": "$self"
{ }
"name": "entity.name.type.mist", ]
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b" },
} "strings": {
] "begin": "\"",
}, "beginCaptures": {
"0": {
"operators": { "name": "punctuation.definition.string.begin.mist"
"patterns": [ }
{ },
"name": "keyword.operator.mist", "end": "\"",
"match": "(==|!=|<=|>=|&&|\\|\\||[+\\-*/<>=])" "endCaptures": {
} "0": {
] "name": "punctuation.definition.string.end.mist"
} }
} },
} "name": "string.quoted.double.mist",
"patterns": [
{
"match": "\\\\.",
"name": "constant.character.escape.mist"
}
]
},
"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": {
"match": "\\b(struct|enum|class|trait)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": {
"name": "storage.type.mist"
},
"2": {
"name": "entity.name.type.mist"
}
}
},
"keywords": {
"patterns": [
{
"match": "\\b(if|else|while|for|in|return|break|continue|match)\\b",
"name": "keyword.control.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)\\b",
"name": "keyword.other.mist"
},
{
"match": "\\bself\\b",
"name": "variable.language.self.mist"
}
]
},
"constants": {
"match": "\\b(true|false)\\b",
"name": "constant.language.boolean.mist"
},
"lifetimes": {
"match": "'[a-zA-Z_][a-zA-Z0-9_]*\\b",
"name": "storage.modifier.lifetime.rust"
},
"types": {
"patterns": [
{
"name": "entity.name.type.primitive.mist",
"match": "\\b(bool|char|str)\\b"
},
{
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b",
"name": "entity.name.type.mist"
}
]
},
"namespaces": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*::)",
"captures": {
"1": {
"name": "entity.name.namespace.mist"
}
}
},
"functions": {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=\\()",
"name": "entity.name.function.mist"
},
"numbers": {
"patterns": [
{
"match": "\\b\\d+\\.\\d+\\b",
"name": "constant.numeric.float.mist"
},
{
"match": "\\b\\d+\\b",
"name": "constant.numeric.integer.mist"
}
]
},
"operators": {
"match": "(<=|>=|==|!=|&&|\\|\\||\\+|-|\\*|/|%|<|>|=|=>|!)",
"name": "keyword.operator.mist"
},
"punctuation": {
"match": "::|:|;|,|\\.|\\{|\\}|\\(|\\)|\\[|\\]",
"name": "punctuation.mist"
}
}
}