hblang-vscode/syntaxes/hblang.tmLanguage.json

234 lines
4.1 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": "#number"
2024-09-28 09:34:34 -05:00
},
{
2024-11-15 15:20:50 -06:00
"include": "#punctuation"
2024-09-28 09:34:34 -05:00
},
{
2024-11-15 15:20:50 -06:00
"include": "#function"
2024-09-28 09:34:34 -05:00
},
{
"include": "#operator"
},
{
2024-11-15 15:20:50 -06:00
"include": "#variable"
},
{
"include": "#type"
2024-09-28 09:34:34 -05:00
},
{
"include": "#array"
}
]
},
"parameter": {
"patterns": [
{
"name": "variable.parameter.hblang",
2024-11-15 15:20:50 -06:00
"match": "\\b\\w+\\s*:\\s*(?:\\^)?[\\w\\$]+\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"number": {
"patterns": [
{
2024-11-15 15:20:50 -06:00
"name": "constant.numeric.float.hblang",
"match": "\\b\\d+\\.\\d+\\b"
2024-09-28 09:34:34 -05:00
},
{
"name": "constant.numeric.hex.hblang",
"match": "0x[0-9A-Fa-f]+"
2024-11-15 15:20:50 -06:00
},
{
"name": "constant.numeric.binary.hblang",
"match": "0b[0-1]+"
},
{
"name": "constant.numeric.octal.hblang",
"match": "0o[0-7]+"
},
{
"name": "constant.numeric.decimal.hblang",
"match": "\\b\\d+\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"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": "\"",
"patterns": [
{
"name": "constant.character.escape.hblang",
2024-11-15 15:20:50 -06:00
"match": "\\\\(?:[\"'\\\\bfnrt]|[{\\[]\\w+[}\\]]|[a-zA-Z])"
2024-09-28 09:34:34 -05:00
},
{
"name": "invalid.illegal.escaped.hblang",
"match": "\\\\."
}
]
}
]
},
"keyword": {
"patterns": [
{
"name": "keyword.control.hblang",
2024-11-30 17:22:30 -06:00
"match": "\\b(fn|loop|break|if|else|return|packed|continue|true|false|struct|idk|die|null|defer)\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"type": {
"patterns": [
{
"name": "storage.type.hblang",
2024-11-15 15:20:50 -06:00
"match": "\\b(f(32|64))|(uint|int|(u|i)(8|16|32)|void|bool|type|never)\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"variable": {
"patterns": [
{
2024-11-15 15:20:50 -06:00
"name": "variable.declaration.hblang",
"match": "\\b\\w+\\b(?=\\s*:=)"
2024-09-28 09:34:34 -05:00
},
{
2024-11-15 15:20:50 -06:00
"name": "variable.assignment.hblang",
"match": "\\b\\w+\\b(?=\\s*=(?!=))"
2024-09-28 10:12:59 -05:00
},
{
2024-11-15 15:20:50 -06:00
"name": "variable.member.hblang",
"match": "(?<=\\.)\\w+\\b"
2024-09-28 09:34:34 -05:00
}
]
},
"operator": {
"patterns": [
2024-11-15 15:20:50 -06:00
{
"name": "keyword.operator.assignment.hblang",
"match": ":="
},
{
"name": "keyword.operator.assignment.hblang",
"match": "=(?!=)"
},
2024-09-28 09:34:34 -05:00
{
"name": "keyword.operator.hblang",
2024-11-15 15:20:50 -06:00
"match": "(\\$|\\?|@|<<=|>>=|>=|<=|\\^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>)"
2024-09-28 09:34:34 -05:00
}
]
},
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",
2024-11-15 15:20:50 -06:00
"match": ";|\\.|,|(?<!:):(?!=)"
2024-09-28 10:27:58 -05:00
}
]
},
2024-09-28 09:34:34 -05:00
"function": {
"patterns": [
{
2024-11-15 15:20:50 -06:00
"name": "meta.function.declaration.hblang",
"begin": "(\\b\\w+\\b)\\s*(:=)\\s*(fn)\\s*\\(",
2024-09-28 09:34:34 -05:00
"end": "\\)",
2024-11-15 15:20:50 -06:00
"beginCaptures": {
"1": {
"name": "entity.name.function.hblang"
},
"2": {
"name": "keyword.operator.assignment.hblang"
},
"3": {
"name": "keyword.control.hblang"
2024-09-28 10:12:59 -05:00
}
},
2024-09-28 09:34:34 -05:00
"patterns": [
{
"include": "#all"
}
]
2024-09-28 10:12:59 -05:00
},
2024-09-28 09:34:34 -05:00
{
2024-11-15 15:20:50 -06:00
"name": "meta.function.call.hblang",
"begin": "@?\\w+\\s*\\(",
2024-09-28 10:12:59 -05:00
"end": "\\)",
2024-11-15 15:20:50 -06:00
"beginCaptures": {
2024-09-28 10:12:59 -05:00
"0": {
"name": "entity.name.function.hblang"
}
},
"patterns": [
{
"include": "#all"
2024-11-15 15:20:50 -06:00
}
]
}
]
},
"array": {
"patterns": [
{
"name": "meta.array.initialization.hblang",
"begin": "\\.\\(",
"end": "\\)",
"patterns": [
2024-09-28 10:12:59 -05:00
{
2024-11-15 15:20:50 -06:00
"include": "#all"
2024-09-28 10:12:59 -05:00
}
]
2024-09-28 09:34:34 -05:00
}
]
}
}
}