hblang-vscode/syntaxes/hblang.tmLanguage.json

221 lines
3.8 KiB
JSON
Raw Normal View History

2024-07-23 15:34:19 -05:00
{
2024-09-28 09:34:34 -05:00
"scopeName": "source.hblang",
"name": "hblang",
"fileTypes": [
"hb"
],
"patterns": [
{
"include": "#all"
}
],
"repository": {
"all": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
2024-09-28 10:27:58 -05:00
{
"include": "#struct"
},
2024-09-28 09:34:34 -05:00
{
2024-09-28 10:12:59 -05:00
"include": "#keyword"
2024-09-28 09:34:34 -05:00
},
{
2024-09-28 10:12:59 -05:00
"include": "#function"
},
{
"include": "#number"
2024-09-28 09:34:34 -05:00
},
{
"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",
2024-09-28 10:12:59 -05:00
"match": "\\b(uint|int|(u|i)(8|16|32)|void|bool|type|never|([A-Z]\\w+))\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"variable": {
"patterns": [
{
2024-09-28 10:12:59 -05:00
"name": "variable.parameter.hblang",
2024-09-28 09:34:34 -05:00
"match": "\\b\\w+\\s*:=\\b"
},
{
2024-09-28 10:12:59 -05:00
"name": "variable.parameter.hblang",
2024-09-28 09:34:34 -05:00
"match": "\\b\\w+\\s*=\\b"
2024-09-28 10:12:59 -05:00
},
{
"name": "variable.parameter.hblang",
"match": "(?<=\\w+\\.)(\\w+)\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"operator": {
"patterns": [
{
"name": "keyword.operator.hblang",
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)"
}
]
},
2024-09-28 10:27:58 -05:00
"struct": {
"patterns": [
{
"name": "entity.name.type.struct.hblang",
"match": "\\b[A-Z]\\w+\\b"
}
]
},
"punctuation": {
"patterns": [
{
"name": "punctuation.terminator.statement.hblang",
"match": ";|\\.|,|:"
}
]
},
2024-09-28 09:34:34 -05:00
"function": {
"patterns": [
{
"name": "entity.name.function.hblang",
2024-09-28 10:12:59 -05:00
"begin": "(?<!\\w)fn\\s*\\(",
2024-09-28 09:34:34 -05:00
"end": "\\)",
2024-09-28 10:12:59 -05:00
"captures": {
"0": {
"name": "keyword.hblang"
}
},
2024-09-28 09:34:34 -05:00
"patterns": [
{
"include": "#all"
},
{
2024-09-28 10:12:59 -05:00
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
2024-09-28 09:34:34 -05:00
}
]
2024-09-28 10:12:59 -05:00
},
2024-09-28 09:34:34 -05:00
{
2024-09-28 10:12:59 -05:00
"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)*"
}
]
2024-09-28 09:34:34 -05:00
}
]
}
2024-09-28 10:12:59 -05:00
},
"array": {
"patterns": [
{
"name": "storage.type.array.hblang",
"begin": "\\.\\(",
"end": "\\)"
}
]
2024-09-28 09:34:34 -05:00
}
}