This commit is contained in:
koniifer 2024-09-28 16:12:59 +01:00
parent a95e98a650
commit adaccda70b
2 changed files with 64 additions and 36 deletions

View file

@ -16,7 +16,6 @@
"Formatters" "Formatters"
], ],
"activationEvents": [ "activationEvents": [
"onLanguage:hblang",
"onCommand:extension.formatDocument" "onCommand:extension.formatDocument"
], ],
"contributes": { "contributes": {

View file

@ -19,10 +19,13 @@
"include": "#string" "include": "#string"
}, },
{ {
"include": "#number" "include": "#keyword"
}, },
{ {
"include": "#keyword" "include": "#function"
},
{
"include": "#number"
}, },
{ {
"include": "#struct" "include": "#struct"
@ -33,9 +36,6 @@
{ {
"include": "#variable" "include": "#variable"
}, },
{
"include": "#function"
},
{ {
"include": "#operator" "include": "#operator"
}, },
@ -122,19 +122,23 @@
"patterns": [ "patterns": [
{ {
"name": "storage.type.hblang", "name": "storage.type.hblang",
"match": "\\buint|int|(u|i)(8|16|32)|void|bool|[A-Z]\\w+\\b" "match": "\\b(uint|int|(u|i)(8|16|32)|void|bool|type|never|([A-Z]\\w+))\\b"
} }
] ]
}, },
"variable": { "variable": {
"patterns": [ "patterns": [
{ {
"name": "variable.other.declaration.hblang", "name": "variable.parameter.hblang",
"match": "\\b\\w+\\s*:=\\b" "match": "\\b\\w+\\s*:=\\b"
}, },
{ {
"name": "variable.other.assignment.hblang", "name": "variable.parameter.hblang",
"match": "\\b\\w+\\s*=\\b" "match": "\\b\\w+\\s*=\\b"
},
{
"name": "variable.parameter.hblang",
"match": "(?<=\\w+\\.)(\\w+)\\b"
} }
] ]
}, },
@ -150,18 +154,44 @@
"patterns": [ "patterns": [
{ {
"name": "entity.name.function.hblang", "name": "entity.name.function.hblang",
"begin": "\\b\\w+\\s*\\(", "begin": "(?<!\\w)fn\\s*\\(",
"end": "\\)", "end": "\\)",
"captures": {
"0": {
"name": "keyword.hblang"
}
},
"patterns": [ "patterns": [
{ {
"include": "#all" "include": "#all"
}, },
{ {
"include": "#parameter" "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": { "struct": {
"patterns": [ "patterns": [
@ -188,5 +218,4 @@
} }
] ]
} }
}
} }