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", "publisher": "koniifer",
"displayName": "hblang", "displayName": "hblang",
"description": "Syntax highlighter and formatter for holey-bytes lang", "description": "Syntax highlighter and formatter for holey-bytes lang",
"version": "0.2.2", "version": "0.2.3",
"engines": { "engines": {
"vscode": "^1.75.0" "vscode": "^1.75.0"
}, },
"main": "./out/main.js", "main": "./out/main.js",
"categories": [ "categories": [
"Programming Languages", "Programming Languages",
"Formatters" "Formatters",
"Linters"
], ],
"activationEvents": [ "activationEvents": [
"onCommand:extension.formatDocument" "onCommand:extension.formatDocument"

View file

@ -24,23 +24,23 @@
{ {
"include": "#keyword" "include": "#keyword"
}, },
{
"include": "#function"
},
{ {
"include": "#number" "include": "#number"
}, },
{ {
"include": "#type" "include": "#punctuation"
}, },
{ {
"include": "#variable" "include": "#function"
}, },
{ {
"include": "#operator" "include": "#operator"
}, },
{ {
"include": "#punctuation" "include": "#variable"
},
{
"include": "#type"
}, },
{ {
"include": "#array" "include": "#array"
@ -51,19 +51,31 @@
"patterns": [ "patterns": [
{ {
"name": "variable.parameter.hblang", "name": "variable.parameter.hblang",
"match": "\\b\\w+\\b" "match": "\\b\\w+\\s*:\\s*(?:\\^)?[\\w\\$]+\\b"
} }
] ]
}, },
"number": { "number": {
"patterns": [ "patterns": [
{ {
"name": "constant.numeric.hblang", "name": "constant.numeric.float.hblang",
"match": "\\b\\d+(\\.\\d+)?\\b" "match": "\\b\\d+\\.\\d+\\b"
}, },
{ {
"name": "constant.numeric.hex.hblang", "name": "constant.numeric.hex.hblang",
"match": "0x[0-9A-Fa-f]+" "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", "name": "string.quoted.double.hblang",
"begin": "\"", "begin": "\"",
"end": "\"", "end": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.hblang"
}
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.hblang"
}
},
"patterns": [ "patterns": [
{ {
"name": "constant.character.escape.hblang", "name": "constant.character.escape.hblang",
"match": "\\\\[\"'\\\\bfnrt]|\\\\(\\{[^}]+\\}|\\[[^]]+\\]|[a-zA-Z])" "match": "\\\\(?:[\"'\\\\bfnrt]|[{\\[]\\w+[}\\]]|[a-zA-Z])"
}, },
{ {
"name": "invalid.illegal.escaped.hblang", "name": "invalid.illegal.escaped.hblang",
@ -114,7 +116,7 @@
"patterns": [ "patterns": [
{ {
"name": "keyword.control.hblang", "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": [ "patterns": [
{ {
"name": "storage.type.hblang", "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": { "variable": {
"patterns": [ "patterns": [
{ {
"name": "variable.parameter.hblang", "name": "variable.declaration.hblang",
"match": "\\b\\w+\\s*:=\\b" "match": "\\b\\w+\\b(?=\\s*:=)"
}, },
{ {
"name": "variable.parameter.hblang", "name": "variable.assignment.hblang",
"match": "\\b\\w+\\s*=\\b" "match": "\\b\\w+\\b(?=\\s*=(?!=))"
}, },
{ {
"name": "variable.parameter.hblang", "name": "variable.member.hblang",
"match": "(?<=\\w+\\.)(\\w+)\\b" "match": "(?<=\\.)\\w+\\b"
} }
] ]
}, },
"operator": { "operator": {
"patterns": [ "patterns": [
{
"name": "keyword.operator.assignment.hblang",
"match": ":="
},
{
"name": "keyword.operator.assignment.hblang",
"match": "=(?!=)"
},
{ {
"name": "keyword.operator.hblang", "name": "keyword.operator.hblang",
"match": "(@|:=|<<=|>>=|>=|<=|^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|&&|\\|\\||<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>|=)" "match": "(\\$|\\?|@|<<=|>>=|>=|<=|\\^=|\\+=|-=|\\*=|\\/=|%=|\\|=|&=|\\^|\\*|&|<<|>>|\\+|\\-|\\/|%|\\||!|==|!=|<|>)"
} }
] ]
}, },
@ -162,36 +172,38 @@
"patterns": [ "patterns": [
{ {
"name": "punctuation.terminator.statement.hblang", "name": "punctuation.terminator.statement.hblang",
"match": ";|\\.|,|:" "match": ";|\\.|,|(?<!:):(?!=)"
} }
] ]
}, },
"function": { "function": {
"patterns": [ "patterns": [
{ {
"name": "entity.name.function.hblang", "name": "meta.function.declaration.hblang",
"begin": "(?<!\\w)fn\\s*\\(", "begin": "(\\b\\w+\\b)\\s*(:=)\\s*(fn)\\s*\\(",
"end": "\\)", "end": "\\)",
"captures": { "beginCaptures": {
"0": { "1": {
"name": "keyword.hblang" "name": "entity.name.function.hblang"
},
"2": {
"name": "keyword.operator.assignment.hblang"
},
"3": {
"name": "keyword.control.hblang"
} }
}, },
"patterns": [ "patterns": [
{ {
"include": "#all" "include": "#all"
},
{
"name": "variable.parameter.hblang",
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
} }
] ]
}, },
{ {
"name": "entity.name.function.hblang", "name": "meta.function.call.hblang",
"begin": "(?:@)?\\b\\w+\\s*\\(", "begin": "@?\\w+\\s*\\(",
"end": "\\)", "end": "\\)",
"captures": { "beginCaptures": {
"0": { "0": {
"name": "entity.name.function.hblang" "name": "entity.name.function.hblang"
} }
@ -199,23 +211,24 @@
"patterns": [ "patterns": [
{ {
"include": "#all" "include": "#all"
}, }
]
}
]
},
"array": {
"patterns": [
{
"name": "meta.array.initialization.hblang",
"begin": "\\.\\(",
"end": "\\)",
"patterns": [
{ {
"name": "variable.parameter.hblang", "include": "#all"
"match": "\\b\\w+\\b(\\s*,\\s*\\b\\w+\\b)*"
} }
] ]
} }
] ]
} }
},
"array": {
"patterns": [
{
"name": "storage.type.array.hblang",
"begin": "\\.\\(",
"end": "\\)"
}
]
} }
} }

View file

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