update & improve grammar somewhat

This commit is contained in:
koniifer 2024-11-15 21:20:50 +00:00
parent 99f66d803a
commit fa7a4bd245
3 changed files with 77 additions and 64 deletions

View file

@ -6,14 +6,15 @@
"publisher": "koniifer",
"displayName": "hblang",
"description": "Syntax highlighter and formatter for holey-bytes lang",
"version": "0.2.2",
"version": "0.2.3",
"engines": {
"vscode": "^1.75.0"
},
"main": "./out/main.js",
"categories": [
"Programming Languages",
"Formatters"
"Formatters",
"Linters"
],
"activationEvents": [
"onCommand:extension.formatDocument"

View file

@ -24,23 +24,23 @@
{
"include": "#keyword"
},
{
"include": "#function"
},
{
"include": "#number"
},
{
"include": "#type"
"include": "#punctuation"
},
{
"include": "#variable"
"include": "#function"
},
{
"include": "#operator"
},
{
"include": "#punctuation"
"include": "#variable"
},
{
"include": "#type"
},
{
"include": "#array"
@ -51,19 +51,31 @@
"patterns": [
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\b"
"match": "\\b\\w+\\s*:\\s*(?:\\^)?[\\w\\$]+\\b"
}
]
},
"number": {
"patterns": [
{
"name": "constant.numeric.hblang",
"match": "\\b\\d+(\\.\\d+)?\\b"
"name": "constant.numeric.float.hblang",
"match": "\\b\\d+\\.\\d+\\b"
},
{
"name": "constant.numeric.hex.hblang",
"match": "0x[0-9A-Fa-f]+"
},
{
"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"
}
]
},
@ -87,20 +99,10 @@
"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])"
"match": "\\\\(?:[\"'\\\\bfnrt]|[{\\[]\\w+[}\\]]|[a-zA-Z])"
},
{
"name": "invalid.illegal.escaped.hblang",
@ -114,7 +116,7 @@
"patterns": [
{
"name": "keyword.control.hblang",
"match": "\\b(loop|break|if|else|return|packed|continue|true|false|struct|idk)\\b"
"match": "\\b(fn|loop|break|if|else|return|packed|continue|true|false|struct|idk|die|null)\\b"
}
]
},
@ -122,31 +124,39 @@
"patterns": [
{
"name": "storage.type.hblang",
"match": "\\b(uint|int|(u|i)(8|16|32)|void|bool|type|never|([A-Z]\\w+))\\b"
"match": "\\b(f(32|64))|(uint|int|(u|i)(8|16|32)|void|bool|type|never)\\b"
}
]
},
"variable": {
"patterns": [
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\s*:=\\b"
"name": "variable.declaration.hblang",
"match": "\\b\\w+\\b(?=\\s*:=)"
},
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\s*=\\b"
"name": "variable.assignment.hblang",
"match": "\\b\\w+\\b(?=\\s*=(?!=))"
},
{
"name": "variable.parameter.hblang",
"match": "(?<=\\w+\\.)(\\w+)\\b"
"name": "variable.member.hblang",
"match": "(?<=\\.)\\w+\\b"
}
]
},
"operator": {
"patterns": [
{
"name": "keyword.operator.assignment.hblang",
"match": ":="
},
{
"name": "keyword.operator.assignment.hblang",
"match": "=(?!=)"
},
{
"name": "keyword.operator.hblang",
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)"
"match": "(\\$|\\?|@|<<=|>>=|>=|<=|\\^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>)"
}
]
},
@ -162,36 +172,38 @@
"patterns": [
{
"name": "punctuation.terminator.statement.hblang",
"match": ";|\\.|,|:"
"match": ";|\\.|,|(?<!:):(?!=)"
}
]
},
"function": {
"patterns": [
{
"name": "entity.name.function.hblang",
"begin": "(?<!\\w)fn\\s*\\(",
"name": "meta.function.declaration.hblang",
"begin": "(\\b\\w+\\b)\\s*(:=)\\s*(fn)\\s*\\(",
"end": "\\)",
"captures": {
"0": {
"name": "keyword.hblang"
"beginCaptures": {
"1": {
"name": "entity.name.function.hblang"
},
"2": {
"name": "keyword.operator.assignment.hblang"
},
"3": {
"name": "keyword.control.hblang"
}
},
"patterns": [
{
"include": "#all"
},
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
}
]
},
{
"name": "entity.name.function.hblang",
"begin": "(?:@)?\\b\\w+\\s*\\(",
"name": "meta.function.call.hblang",
"begin": "@?\\w+\\s*\\(",
"end": "\\)",
"captures": {
"beginCaptures": {
"0": {
"name": "entity.name.function.hblang"
}
@ -199,23 +211,24 @@
"patterns": [
{
"include": "#all"
},
}
]
}
]
},
"array": {
"patterns": [
{
"name": "meta.array.initialization.hblang",
"begin": "\\.\\(",
"end": "\\)",
"patterns": [
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
"include": "#all"
}
]
}
]
}
},
"array": {
"patterns": [
{
"name": "storage.type.array.hblang",
"begin": "\\.\\(",
"end": "\\)"
}
]
}
}

View file

@ -6,20 +6,19 @@ module.exports = {
output: {
path: path.resolve(__dirname, 'out'),
filename: 'main.js',
libraryTarget: 'commonjs2' // This is correct for VS Code extensions
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['.ts', '.js'],
fallback: {
// For Node.js core modules not available in browser context, you set them to false
"child_process": false, // Not used in browser context
"fs": false, // Not used in browser context
"os": require.resolve("os-browserify/browser"), // Polyfill for os
"path": require.resolve("path-browserify"), // Polyfill for path
"child_process": false,
"fs": false,
"os": require.resolve("os-browserify/browser"),
"path": require.resolve("path-browserify"),
},
},
externals: {
vscode: 'commonjs vscode' // Externalize the vscode module
vscode: 'commonjs vscode'
},
module: {
rules: [
@ -30,5 +29,5 @@ module.exports = {
}
]
},
target: 'node' // Specify the target environment as Node.js
target: 'node'
};