From f1412061f258e12358449343ec680057c97419e6 Mon Sep 17 00:00:00 2001 From: Xircon Date: Sun, 2 Aug 2026 02:12:22 -0400 Subject: [PATCH] AI poop out a vs code extension (that honestly barely works111!!) --- examples/compact/exitall.x | 6 +- vs-extension/CHANGELOG.md | 11 ++- vs-extension/LICENSE | 29 +++++++ vs-extension/README.md | 24 +++++- vs-extension/language-configuration.json | 9 +-- vs-extension/package.json | 4 +- vs-extension/syntaxes/xlang.tmLanguage.json | 87 +++++++++++++++++---- 7 files changed, 140 insertions(+), 30 deletions(-) create mode 100644 vs-extension/LICENSE diff --git a/examples/compact/exitall.x b/examples/compact/exitall.x index 003b6fb..17ee1c6 100644 --- a/examples/compact/exitall.x +++ b/examples/compact/exitall.x @@ -4,8 +4,8 @@ var x = 1 + 2 * 3; var y = 2; } var y = x - 3; -var z = (3*5) / 3; +var z = (3 * 5) / 3; if (x) { - exit(y + z); + exit(y + z); } -exit (1); \ No newline at end of file +exit (1); // Should never exit \ No newline at end of file diff --git a/vs-extension/CHANGELOG.md b/vs-extension/CHANGELOG.md index 031faeb..94fcb6a 100644 --- a/vs-extension/CHANGELOG.md +++ b/vs-extension/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 0.0.2 + +- Added operator highlighting (+, -, *, /) +- Added variable highlighting for declarations (var keyword) and usage +- Added bracket/parenthesis highlighting +- Fixed comment highlighting for single-line and block comments +- Added BSD-3-Clause license +- Improved scope names for better VSCode theme compatibility + ## 0.0.1 -- Initial release \ No newline at end of file +- Initial release diff --git a/vs-extension/LICENSE b/vs-extension/LICENSE new file mode 100644 index 0000000..92f708a --- /dev/null +++ b/vs-extension/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2026, Xircon Contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vs-extension/README.md b/vs-extension/README.md index cb1a80c..5aa1042 100644 --- a/vs-extension/README.md +++ b/vs-extension/README.md @@ -2,10 +2,30 @@ ## Features -Adds syntax highlighting for XLang thats it. +- **Syntax Highlighting**: Full syntax highlighting support for XLang language +- **Keywords**: Highlighting for control flow keywords (if, else, return, var, exit) +- **Comments**: Support for single-line (//) and block (/* */) comments +- **Strings**: Double-quoted string highlighting with escape sequence support +- **Operators**: Highlighting for arithmetic operators (+, -, *, /) +- **Brackets**: Highlighting for parentheses (), square brackets [], and curly braces {} +- **Variables**: Highlighting for variable declarations and usage +- **Auto-closing Pairs**: Auto-completion for brackets, quotes, and parentheses + +## Language Support + +Syntax highlighting for files with `.x` extension. ## Release Notes +### 0.0.2 + +- Added operator highlighting +- Added variable highlighting (declarations with `var` and usage) +- Added bracket/parenthesis highlighting +- Fixed comment highlighting (both line and block comments) +- Added BSD-3-Clause license + ### 0.0.1 -Initial release +- Initial release with basic keyword and string highlighting + diff --git a/vs-extension/language-configuration.json b/vs-extension/language-configuration.json index 8f162a0..71e5435 100644 --- a/vs-extension/language-configuration.json +++ b/vs-extension/language-configuration.json @@ -1,17 +1,13 @@ { "comments": { - // symbol used for single line comment. Remove this entry if your language does not support line comments "lineComment": "//", - // symbols used for start and end a block comment. Remove this entry if your language does not support block comments "blockComment": [ "/*", "*/" ] }, - // symbols used as brackets "brackets": [ ["{", "}"], ["[", "]"], ["(", ")"] ], - // symbols that are auto closed when typing "autoClosingPairs": [ ["{", "}"], ["[", "]"], @@ -19,12 +15,13 @@ ["\"", "\""], ["'", "'"] ], - // symbols that can be used to surround a selection + "autoCloseBefore": ":;,.)]}'\"`", "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"], ["\"", "\""], - ["'", "'"] + ["'", "'"], + ["/*", "*/"] ] } \ No newline at end of file diff --git a/vs-extension/package.json b/vs-extension/package.json index dbef3e2..3aea937 100644 --- a/vs-extension/package.json +++ b/vs-extension/package.json @@ -2,7 +2,7 @@ "name": "xlang", "displayName": "XLang", "description": "Syntax highlighting for XLang.", - "version": "0.0.1", + "version": "0.0.2", "engines": { "vscode": "^1.120.0" }, @@ -23,3 +23,5 @@ }] } } + + diff --git a/vs-extension/syntaxes/xlang.tmLanguage.json b/vs-extension/syntaxes/xlang.tmLanguage.json index c75fa82..ba69cd3 100644 --- a/vs-extension/syntaxes/xlang.tmLanguage.json +++ b/vs-extension/syntaxes/xlang.tmLanguage.json @@ -2,42 +2,95 @@ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "xlang", "patterns": [ + { + "include": "#comments" + }, + { + "include": "#operators" + }, + { + "include": "#brackets" + }, + { + "include": "#variables" + }, { "include": "#keywords" }, { "include": "#strings" - }, - { - "include": "#operators" } ], "repository": { "keywords": { "patterns": [{ - "name": "keyword.control.xlang", + "name": "keyword.control", "match": "\\b(if|else|return|var|exit)\\b" }] }, "strings": { - "name": "string.quoted.double.xlang", - "begin": "\"", - "end": "\"", "patterns": [ { - "name": "constant.character.escape.xlang", - "match": "\\\\." + "name": "string.quoted.double", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape", + "match": "\\\\." + } + ] + } + ] + }, + "operators": { + "patterns": [ + { + "name": "keyword.operator", + "match": "[+*/-]|\\*|/" + } + ] + }, + "brackets": { + "patterns": [ + { + "name": "punctuation.bracket", + "match": "[\\(\\)\\[\\]\\{\\}]" + } + ] + }, + "variables": { + "patterns": [ + { + "match": "\\bvar\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "captures": { + "0": { + "name": "keyword.control" + }, + "1": { + "name": "variable.other" + } + } + }, + { + "name": "variable.other", + "match": "\\b(?!if|else|return|var|exit\\b)[a-zA-Z_][a-zA-Z0-9_]*\\b" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.line.double-slash", + "match": "//.*$" + }, + { + "name": "comment.block", + "begin": "/\\*", + "end": "\\*/" } ] } }, - "operators": { - "patterns": [ - { - "name": "keyword.operator.xlang", - "match": "*|+|-|/" - } - ] - }, "scopeName": "source.x" } \ No newline at end of file