hblang-vscode/syntaxes/hblang.tmLanguage.json
2024-07-23 21:34:19 +01:00

158 lines
3.2 KiB
JSON

{
"scopeName": "source.hblang",
"name": "hblang",
"fileTypes": ["hb"],
"patterns": [
{
"include": "#comments"
},
{
"include": "#strings"
},
{
"include": "#keywords"
},
{
"include": "#types"
},
{
"include": "#declarations"
},
{
"include": "#functions"
},
{
"include": "#macros"
},
{
"include": "#structs"
},
{
"include": "#arrays"
},
{
"include": "#pointers"
},
{
"include": "#operators"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.block.hblang",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "comment.line.double-slash.hblang",
"begin": "//",
"end": "$"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.hblang",
"begin": "\"",
"end": "\""
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.hblang",
"match": "\\b(loop|break|if|else|return)\\b"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.hblang",
"match": "\\b(uint|int|void|u\\d+|i\\d+|f\\d+)\\b"
}
]
},
"declarations": {
"patterns": [
{
"name": "variable.other.declaration.hblang",
"match": "\\b[A-Z_][A-Z0-9_]*\\b"
},
{
"name": "variable.other.assignment.hblang",
"match": "\\b[a-z_][a-z0-9_]*\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.hblang",
"match": "\\b(\\^|\\*|&|<<|>>|>>>|<<=|>>=|>>>=|\\+|\\-|\\*|\\/|%|\\|\\||&&|!|==|!=|<|<=|>|>=|\\||&|\\^|~|<<|>>|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^=|~=|<<=|>>=|>>>|@\\w+)\\b"
}
]
},
"functions": {
"patterns": [
{
"name": "entity.name.function.hblang",
"match": "\\b[a-z_][a-z0-9_]*\\b(?=\\()"
}
]
},
"macros": {
"patterns": [
{
"name": "entity.name.macro.hblang",
"match": "@\\b[a-z_][a-z0-9_]*\\b"
}
]
},
"structs": {
"patterns": [
{
"name": "storage.type.struct.hblang",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\s*:=\\s*struct\\b"
},
{
"name": "storage.type.struct.hblang",
"match": "\\b\\.[a-zA-Z_][a-zA-Z0-9_]*\\b"
}
]
},
"arrays": {
"patterns": [
{
"name": "storage.type.array.hblang",
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b\\]"
},
{
"name": "storage.type.array.hblang",
"match": "\\[\\b[a-zA-Z_][a-zA-Z0-9_]*\\b;\\s*\\d+\\]"
}
]
},
"pointers": {
"patterns": [
{
"name": "storage.modifier.pointer.hblang",
"match": "\\^+"
},
{
"name": "keyword.operator.dereference.hblang",
"match": "\\*+"
},
{
"name": "keyword.operator.reference.hblang",
"match": "\\&+"
}
]
}
}
}