Working syntax
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@
|
||||
"languages": [{
|
||||
"id": "mist",
|
||||
"aliases": ["Mist", "mist"],
|
||||
"extensions": [".ms"],
|
||||
"extensions": [".mist"],
|
||||
"configuration": "./language-configuration.json"
|
||||
}],
|
||||
"grammars": [{
|
||||
|
||||
+155
-48
@@ -3,85 +3,192 @@
|
||||
"name": "Mist",
|
||||
"scopeName": "source.mist",
|
||||
"patterns": [
|
||||
{ "include": "#comments" },
|
||||
{ "include": "#keywords" },
|
||||
{ "include": "#strings" },
|
||||
{ "include": "#numbers" },
|
||||
{ "include": "#types" },
|
||||
{ "include": "#operators" }
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#attributes"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#macros"
|
||||
},
|
||||
{
|
||||
"include": "#type_declarations"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#lifetimes"
|
||||
},
|
||||
{
|
||||
"include": "#types"
|
||||
},
|
||||
{
|
||||
"include": "#namespaces"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#punctuation"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"match": "//.*",
|
||||
"name": "comment.line.double-slash.mist"
|
||||
},
|
||||
"attributes": {
|
||||
"begin": "#!?\\[",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.attribute.begin.mist"
|
||||
}
|
||||
},
|
||||
"end": "\\]",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.attribute.end.mist"
|
||||
}
|
||||
},
|
||||
"name": "meta.attribute.mist",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.line.double-slash.mist",
|
||||
"match": "//.*$"
|
||||
"include": "$self"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"strings": {
|
||||
"begin": "\"",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.mist"
|
||||
}
|
||||
},
|
||||
"end": "\"",
|
||||
"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": [
|
||||
{
|
||||
"name": "keyword.control.flow.mist",
|
||||
"match": "\\b(if|else|for|return|function|class|struct|import|let|const)\\b"
|
||||
"match": "\\b(if|else|while|for|in|return|break|continue|match)\\b",
|
||||
"name": "keyword.control.mist"
|
||||
},
|
||||
{
|
||||
"name": "constant.language.null.mist",
|
||||
"match": "\\b(null)\\b"
|
||||
"match": "\\b(struct|enum|class|trait|var)\\b",
|
||||
"name": "storage.type.mist"
|
||||
},
|
||||
{
|
||||
"name": "constant.language.this.mist",
|
||||
"match": "\\b(this)\\b"
|
||||
"match": "\\b(pub|mut|constructor)\\b",
|
||||
"name": "storage.modifier.mist"
|
||||
},
|
||||
{
|
||||
"name": "constant.language.boolean.mist",
|
||||
"match": "\\b(true|false)\\b"
|
||||
"match": "\\b(impl|use|mod|new|void)\\b",
|
||||
"name": "keyword.other.mist"
|
||||
},
|
||||
{
|
||||
"match": "\\bself\\b",
|
||||
"name": "variable.language.self.mist"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"strings": {
|
||||
"name": "string.quoted.double.mist",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.mist",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
"constants": {
|
||||
"match": "\\b(true|false)\\b",
|
||||
"name": "constant.language.boolean.mist"
|
||||
},
|
||||
|
||||
"numbers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.numeric.float.mist",
|
||||
"match": "\\b\\d+\\.\\d+\\b"
|
||||
"lifetimes": {
|
||||
"match": "'[a-zA-Z_][a-zA-Z0-9_]*\\b",
|
||||
"name": "storage.modifier.lifetime.rust"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer.mist",
|
||||
"match": "\\b\\d+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"types": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.type.mist",
|
||||
"match": "\\b[A-Z][a-zA-Z0-9_]*\\b"
|
||||
"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"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"operators": {
|
||||
"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": [
|
||||
{
|
||||
"name": "keyword.operator.mist",
|
||||
"match": "(==|!=|<=|>=|&&|\\|\\||[+\\-*/<>=])"
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user