so... jai :D

This commit is contained in:
agra
2026-02-04 01:34:30 +02:00
commit 55fc5790e4
60 changed files with 15876 additions and 0 deletions

2
editors/vscode/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules/
out/

View File

@@ -0,0 +1,3 @@
src/
tsconfig.json
.gitignore

View File

@@ -0,0 +1,22 @@
{
"comments": {
"lineComment": "//"
},
"brackets": [
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"", "notIn": ["string"] }
],
"surroundingPairs": [
{ "open": "{", "close": "}" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"" }
],
"indentationRules": {
"increaseIndentPattern": "\\{\\s*$",
"decreaseIndentPattern": "^\\s*\\}"
}
}

121
editors/vscode/package-lock.json generated Normal file
View File

@@ -0,0 +1,121 @@
{
"name": "sx-lang",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sx-lang",
"version": "0.0.1",
"dependencies": {
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@types/vscode": "^1.75.0",
"typescript": "^5.0.0"
},
"engines": {
"vscode": "^1.75.0"
}
},
"node_modules/@types/vscode": {
"version": "1.108.1",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.108.1.tgz",
"integrity": "sha512-DerV0BbSzt87TbrqmZ7lRDIYaMiqvP8tmJTzW2p49ZBVtGUnGAu2RGQd1Wv4XMzEVUpaHbsemVM5nfuQJj7H6w==",
"dev": true,
"license": "MIT"
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/semver": {
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/vscode-jsonrpc": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz",
"integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/vscode-languageclient": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-9.0.1.tgz",
"integrity": "sha512-JZiimVdvimEuHh5olxhxkht09m3JzUGwggb5eRUkzzJhZ2KjCN0nh55VfiED9oez9DyF8/fz1g1iBV3h+0Z2EA==",
"license": "MIT",
"dependencies": {
"minimatch": "^5.1.0",
"semver": "^7.3.7",
"vscode-languageserver-protocol": "3.17.5"
},
"engines": {
"vscode": "^1.82.0"
}
},
"node_modules/vscode-languageserver-protocol": {
"version": "3.17.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz",
"integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==",
"license": "MIT",
"dependencies": {
"vscode-jsonrpc": "8.2.0",
"vscode-languageserver-types": "3.17.5"
}
},
"node_modules/vscode-languageserver-types": {
"version": "3.17.5",
"resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz",
"integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==",
"license": "MIT"
}
}
}

View File

@@ -0,0 +1,68 @@
{
"name": "sx-lang",
"displayName": "sx",
"description": "Language support for the sx programming language",
"version": "0.0.1",
"publisher": "swipelab",
"engines": {
"vscode": "^1.75.0"
},
"categories": [
"Programming Languages"
],
"main": "./out/extension.js",
"contributes": {
"languages": [
{
"id": "sx",
"aliases": [
"sx"
],
"extensions": [
".sx"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "sx",
"scopeName": "source.sx",
"path": "./syntaxes/sx.tmLanguage.json"
}
],
"configuration": {
"title": "sx",
"properties": {
"sx.lspPath": {
"type": "string",
"default": "sx-lsp",
"description": "Path to the sx-lsp binary"
}
}
},
"configurationDefaults": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "punctuation.definition.template-expression",
"settings": {
"foreground": "#E5C07B"
}
}
]
}
}
},
"scripts": {
"build": "tsc -p .",
"watch": "tsc -watch -p ."
},
"dependencies": {
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@types/vscode": "^1.75.0",
"typescript": "^5.0.0"
}
}

View File

@@ -0,0 +1,41 @@
import {
workspace,
ExtensionContext,
} from "vscode";
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
} from "vscode-languageclient/node";
let client: LanguageClient;
export function activate(context: ExtensionContext) {
const config = workspace.getConfiguration("sx");
const lspPath = config.get<string>("lspPath", "sx-lsp");
const serverOptions: ServerOptions = {
command: lspPath,
args: ["lsp"],
};
const clientOptions: LanguageClientOptions = {
documentSelector: [{ scheme: "file", language: "sx" }],
};
client = new LanguageClient(
"sx-lsp",
"sx Language Server",
serverOptions,
clientOptions
);
client.start();
}
export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}

Binary file not shown.

View File

@@ -0,0 +1,208 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "sx",
"scopeName": "source.sx",
"patterns": [
{ "include": "#comments" },
{ "include": "#strings" },
{ "include": "#directives" },
{ "include": "#keywords" },
{ "include": "#types" },
{ "include": "#type-declaration" },
{ "include": "#type-annotation" },
{ "include": "#constants" },
{ "include": "#numbers" },
{ "include": "#operators" },
{ "include": "#function-declaration" },
{ "include": "#enum-literal" },
{ "include": "#identifiers" }
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.double-slash.sx",
"match": "//.*$"
}
]
},
"strings": {
"patterns": [
{
"begin": "\"",
"end": "\"",
"beginCaptures": {
"0": { "name": "punctuation.definition.string.begin.sx" }
},
"endCaptures": {
"0": { "name": "punctuation.definition.string.end.sx" }
},
"patterns": [
{
"name": "constant.character.escape.sx",
"match": "\\\\[ntr\"\\\\{}]"
},
{
"begin": "\\{",
"end": "\\}",
"beginCaptures": {
"0": { "name": "punctuation.definition.template-expression.begin.sx" }
},
"endCaptures": {
"0": { "name": "punctuation.definition.template-expression.end.sx" }
},
"patterns": [
{ "include": "$self" }
]
},
{
"name": "string.quoted.double.sx",
"match": "[^\"\\\\{}]+"
}
]
}
]
},
"directives": {
"patterns": [
{
"name": "keyword.other.directive.sx",
"match": "#run"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.sx",
"match": "\\b(if|else|then|return|case|break|defer)\\b"
},
{
"name": "keyword.other.sx",
"match": "\\b(enum|struct)\\b"
},
{
"name": "keyword.operator.cast.sx",
"match": "\\bxx\\b"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.sx",
"match": "\\b(s[0-9]+|u[0-9]+|f32|f64|bool|string)\\b"
}
]
},
"type-declaration": {
"patterns": [
{
"match": "([A-Z][a-zA-Z0-9_]*)\\s*(::)\\s*(?=struct\\b|enum\\b)",
"captures": {
"1": { "name": "entity.name.type.sx" },
"2": { "name": "keyword.operator.declaration.sx" }
}
}
]
},
"type-annotation": {
"patterns": [
{
"match": "(?<![:]):\\s*(?![=:])([A-Z][a-zA-Z0-9_]*)\\b",
"captures": {
"1": { "name": "entity.name.type.sx" }
}
}
]
},
"constants": {
"patterns": [
{
"name": "constant.language.sx",
"match": "\\b(true|false)\\b"
},
{
"name": "constant.language.undefined.sx",
"match": "---"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.float.sx",
"match": "\\b[0-9]+\\.[0-9]+\\b"
},
{
"name": "constant.numeric.integer.sx",
"match": "\\b[0-9]+\\b"
}
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.declaration.sx",
"match": "::"
},
{
"name": "keyword.operator.walrus.sx",
"match": ":="
},
{
"name": "keyword.operator.arrow.sx",
"match": "->|=>"
},
{
"name": "keyword.operator.comparison.sx",
"match": "==|!=|<=|>="
},
{
"name": "keyword.operator.assignment.sx",
"match": "[+\\-*/]="
},
{
"name": "keyword.operator.sx",
"match": "[+\\-*/=<>!]"
}
]
},
"function-declaration": {
"patterns": [
{
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*(::)\\s*(?=\\(|\\{)",
"captures": {
"1": { "name": "entity.name.function.sx" },
"2": { "name": "keyword.operator.declaration.sx" }
}
}
]
},
"enum-literal": {
"patterns": [
{
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": { "name": "variable.other.enummember.sx" }
}
}
]
},
"identifiers": {
"patterns": [
{
"name": "variable.other.generic-type.sx",
"match": "\\$([a-zA-Z_][a-zA-Z0-9_]*)",
"captures": {
"1": { "name": "entity.name.type.parameter.sx" }
}
},
{
"match": "\\b(io)\\b",
"name": "support.module.sx"
}
]
}
}
}

View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"outDir": "out",
"rootDir": "src",
"lib": ["ES2020"],
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["node_modules"]
}