hblang-vscode/syntaxes/hblang.tmLanguage.json
2024-09-28 15:34:34 +01:00

192 lines
3.2 KiB
JSON

{
"scopeName": "source.hblang",
"name": "hblang",
"fileTypes": [
"hb"
],
"patterns": [
{
"include": "#all"
}
],
"repository": {
"all": {
"patterns": [
{
"include": "#comment"
},
{
"include": "#string"
},
{
"include": "#number"
},
{
"include": "#keyword"
},
{
"include": "#struct"
},
{
"include": "#type"
},
{
"include": "#variable"
},
{
"include": "#function"
},
{
"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": "\\buint|int|(u|i)(8|16|32)|void|bool|[A-Z]\\w+\\b"
}
]
},
"variable": {
"patterns": [
{
"name": "variable.other.declaration.hblang",
"match": "\\b\\w+\\s*:=\\b"
},
{
"name": "variable.other.assignment.hblang",
"match": "\\b\\w+\\s*=\\b"
}
]
},
"operator": {
"patterns": [
{
"name": "keyword.operator.hblang",
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)"
}
]
},
"function": {
"patterns": [
{
"name": "entity.name.function.hblang",
"begin": "\\b\\w+\\s*\\(",
"end": "\\)",
"patterns": [
{
"include": "#all"
},
{
"include": "#parameter"
}
]
}
]
},
"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": ";|\\.|,|:"
}
]
}
}
}