diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..7fe41e6 --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,31 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": ["/*", "*/"] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "/*", "close": "*/", "notIn": ["string"] } + ], + "surroundingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"" } + ], + "folding": { + "markers": { + "start": "^\\s*//\\s*#region\\b", + "end": "^\\s*//\\s*#endregion\\b" + } + } + } + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..586c9c6 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "hblang", + "publisher": "aurlex", + "displayName": "hblang", + "description": "Syntax highlighting for holey-bytes lang", + "version": "0.0.1", + "engines": { + "vscode": "^1.91.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [{ + "id": "hblang", + "aliases": ["hblang", "hblang"], + "extensions": [".hb"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "hblang", + "scopeName": "source.hblang", + "path": "./syntaxes/hblang.tmLanguage.json" + }] + } +} diff --git a/syntaxes/hblang.tmLanguage.json b/syntaxes/hblang.tmLanguage.json new file mode 100644 index 0000000..3971758 --- /dev/null +++ b/syntaxes/hblang.tmLanguage.json @@ -0,0 +1,157 @@ +{ + "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": "\\&+" + } + ] + } + } +}