221 lines
3.8 KiB
JSON
221 lines
3.8 KiB
JSON
{
|
|
"scopeName": "source.hblang",
|
|
"name": "hblang",
|
|
"fileTypes": [
|
|
"hb"
|
|
],
|
|
"patterns": [
|
|
{
|
|
"include": "#all"
|
|
}
|
|
],
|
|
"repository": {
|
|
"all": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comment"
|
|
},
|
|
{
|
|
"include": "#string"
|
|
},
|
|
{
|
|
"include": "#keyword"
|
|
},
|
|
{
|
|
"include": "#function"
|
|
},
|
|
{
|
|
"include": "#number"
|
|
},
|
|
{
|
|
"include": "#struct"
|
|
},
|
|
{
|
|
"include": "#type"
|
|
},
|
|
{
|
|
"include": "#variable"
|
|
},
|
|
{
|
|
"include": "#operator"
|
|
},
|
|
{
|
|
"include": "#punctuation"
|
|
},
|
|
{
|
|
"include": "#array"
|
|
}
|
|
]
|
|
},
|
|
"parameter": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "\\b\\w+\\b"
|
|
}
|
|
]
|
|
},
|
|
"number": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.hblang",
|
|
"match": "\\b\\d+(\\.\\d+)?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.hex.hblang",
|
|
"match": "0x[0-9A-Fa-f]+"
|
|
}
|
|
]
|
|
},
|
|
"comment": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.block.hblang",
|
|
"begin": "/\\*",
|
|
"end": "\\*/"
|
|
},
|
|
{
|
|
"name": "comment.line.double-slash.hblang",
|
|
"begin": "//",
|
|
"end": "$"
|
|
}
|
|
]
|
|
},
|
|
"string": {
|
|
"patterns": [
|
|
{
|
|
"name": "string.quoted.double.hblang",
|
|
"begin": "\"",
|
|
"end": "\"",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.begin.hblang"
|
|
}
|
|
},
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.end.hblang"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.hblang",
|
|
"match": "\\\\[\"'\\\\bfnrt]|\\\\(\\{[^}]+\\}|\\[[^]]+\\]|[a-zA-Z])"
|
|
},
|
|
{
|
|
"name": "invalid.illegal.escaped.hblang",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"keyword": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.hblang",
|
|
"match": "\\b(loop|break|if|else|return|packed|continue|true|false|struct|idk)\\b"
|
|
}
|
|
]
|
|
},
|
|
"type": {
|
|
"patterns": [
|
|
{
|
|
"name": "storage.type.hblang",
|
|
"match": "\\b(uint|int|(u|i)(8|16|32)|void|bool|type|never|([A-Z]\\w+))\\b"
|
|
}
|
|
]
|
|
},
|
|
"variable": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "\\b\\w+\\s*:=\\b"
|
|
},
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "\\b\\w+\\s*=\\b"
|
|
},
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "(?<=\\w+\\.)(\\w+)\\b"
|
|
}
|
|
]
|
|
},
|
|
"operator": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.operator.hblang",
|
|
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)"
|
|
}
|
|
]
|
|
},
|
|
"function": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.function.hblang",
|
|
"begin": "(?<!\\w)fn\\s*\\(",
|
|
"end": "\\)",
|
|
"captures": {
|
|
"0": {
|
|
"name": "keyword.hblang"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#all"
|
|
},
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "entity.name.function.hblang",
|
|
"begin": "(?:@)?\\b\\w+\\s*\\(",
|
|
"end": "\\)",
|
|
"captures": {
|
|
"0": {
|
|
"name": "entity.name.function.hblang"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#all"
|
|
},
|
|
{
|
|
"name": "variable.parameter.hblang",
|
|
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"struct": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.type.struct.hblang",
|
|
"match": "\\b[A-Z]\\w+\\b"
|
|
}
|
|
]
|
|
},
|
|
"array": {
|
|
"patterns": [
|
|
{
|
|
"name": "storage.type.array.hblang",
|
|
"begin": "\\.\\(",
|
|
"end": "\\)"
|
|
}
|
|
]
|
|
},
|
|
"punctuation": {
|
|
"patterns": [
|
|
{
|
|
"name": "punctuation.terminator.statement.hblang",
|
|
"match": ";|\\.|,|:"
|
|
}
|
|
]
|
|
}
|
|
} |