utkrisht 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/input.uki +4 -0
- package/compiler/keywords.js +15 -0
- package/compiler/lexer.js +602 -0
- package/compiler/logger.js +11 -0
- package/compiler/parser.js +375 -0
- package/compiler/utkrisht.js +53 -0
- package/extension/readme.md +3 -0
- package/extension/utkrisht/.vscode/extensions.json +8 -0
- package/extension/utkrisht/.vscode/launch.json +17 -0
- package/extension/utkrisht/.vscode-test.mjs +5 -0
- package/extension/utkrisht/.vscodeignore +10 -0
- package/extension/utkrisht/CHANGELOG.md +9 -0
- package/extension/utkrisht/README.md +65 -0
- package/extension/utkrisht/eslint.config.mjs +25 -0
- package/extension/utkrisht/jsconfig.json +13 -0
- package/extension/utkrisht/language-configuration.json +62 -0
- package/extension/utkrisht/merge.svg +8 -0
- package/extension/utkrisht/package-lock.json +2929 -0
- package/extension/utkrisht/package.json +66 -0
- package/extension/utkrisht/src/main.js +31 -0
- package/extension/utkrisht/syntaxes/utkrisht.json +143 -0
- package/extension/utkrisht/vsc-extension-quickstart.md +42 -0
- package/package.json +20 -0
- package/readme.md +491 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "utkrisht",
|
|
3
|
+
"displayName": "utkrisht",
|
|
4
|
+
"description": "Official language support for the Utkrisht programming language.",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"engines": {
|
|
7
|
+
"vscode": "^1.107.0"
|
|
8
|
+
},
|
|
9
|
+
"categories": [
|
|
10
|
+
"Other"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"activationEvents": [],
|
|
14
|
+
"main": "./src/main.js",
|
|
15
|
+
"contributes": {
|
|
16
|
+
"commands": [
|
|
17
|
+
{
|
|
18
|
+
"command": "utkrisht.run",
|
|
19
|
+
"title": "Run",
|
|
20
|
+
"icon": "$(run)"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"languages": [
|
|
24
|
+
{
|
|
25
|
+
"id": "utkrisht",
|
|
26
|
+
"aliases": [
|
|
27
|
+
"Utkrisht"
|
|
28
|
+
],
|
|
29
|
+
"extensions": [
|
|
30
|
+
".uki"
|
|
31
|
+
],
|
|
32
|
+
"configuration": "./language-configuration.json"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"grammars": [
|
|
36
|
+
{
|
|
37
|
+
"language": "utkrisht",
|
|
38
|
+
"scopeName": "source.utkrisht",
|
|
39
|
+
"path": "./syntaxes/utkrisht.json"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"menus": {
|
|
43
|
+
"editor/title": [
|
|
44
|
+
{
|
|
45
|
+
"when": "resourceLangId == utkrisht",
|
|
46
|
+
"command": "utkrisht.run",
|
|
47
|
+
"group": "navigation"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"lint": "eslint .",
|
|
55
|
+
"pretest": "npm run lint",
|
|
56
|
+
"test": "vscode-test"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/vscode": "^1.107.0",
|
|
60
|
+
"@types/mocha": "^10.0.10",
|
|
61
|
+
"@types/node": "22.x",
|
|
62
|
+
"eslint": "^9.36.0",
|
|
63
|
+
"@vscode/test-cli": "^0.0.11",
|
|
64
|
+
"@vscode/test-electron": "^2.5.2"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
|
|
3
|
+
export function activate(context) {
|
|
4
|
+
context.subscriptions.push(
|
|
5
|
+
vscode.commands.registerCommand("utkrisht.compile", async () => {
|
|
6
|
+
const editor = vscode.window.activeTextEditor;
|
|
7
|
+
if (!editor) {
|
|
8
|
+
vscode.window.showErrorMessage("No active editor");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const inputUri = editor.document.uri;
|
|
13
|
+
|
|
14
|
+
// Read input file
|
|
15
|
+
const data = await vscode.workspace.fs.readFile(inputUri);
|
|
16
|
+
|
|
17
|
+
// Get parent folder
|
|
18
|
+
const folderUri = vscode.Uri.joinPath(inputUri, "..");
|
|
19
|
+
|
|
20
|
+
// Create output file URI
|
|
21
|
+
const outputUri = vscode.Uri.joinPath(folderUri, "out.uki");
|
|
22
|
+
|
|
23
|
+
// Write output file
|
|
24
|
+
await vscode.workspace.fs.writeFile(outputUri, data);
|
|
25
|
+
|
|
26
|
+
vscode.window.showInformationMessage("Compiled to out.uki");
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
//
|
|
31
|
+
export function deactivate() { }
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
3
|
+
"name": "Utkrisht",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"include": "#keywords"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"include": "#comment"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"include": "#strings"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"include": "#number"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"include": "#constant"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"include": "#function"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"include": "#parameter"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"include": "#variable"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"keywords": {
|
|
32
|
+
"patterns": [
|
|
33
|
+
{
|
|
34
|
+
"name": "keyword.control",
|
|
35
|
+
"match": "\\b(try|fix|when|else|loop|with|take|stop|skip|exit|import|export)\\b"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "constant.language",
|
|
39
|
+
"match": "\\b(right|wrong)\\b"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"variable": {
|
|
44
|
+
"patterns": [
|
|
45
|
+
{
|
|
46
|
+
"name": "variable.name",
|
|
47
|
+
"match": "[a-z](?:[a-z]|[0-9]|-(?!-))*[a-z0-9]?"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"strings": {
|
|
52
|
+
"patterns": [
|
|
53
|
+
{
|
|
54
|
+
"name": "string.quoted.double.utkrisht",
|
|
55
|
+
"begin": "\"",
|
|
56
|
+
"beginCaptures": {
|
|
57
|
+
"0": {
|
|
58
|
+
"name": "punctuation.definition.string.begin"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"end": "\"",
|
|
62
|
+
"endCaptures": {
|
|
63
|
+
"0": {
|
|
64
|
+
"name": "punctuation.definition.string.end"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"patterns": [
|
|
68
|
+
{
|
|
69
|
+
"name": "constant.character.escape.utkrisht",
|
|
70
|
+
"match": "\\\\(\"|\\\\|n|r|t|b|f|v|0|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\})"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "string.interpolated.utkrisht",
|
|
74
|
+
"begin": "\\\\\\(",
|
|
75
|
+
"beginCaptures": {
|
|
76
|
+
"0": {
|
|
77
|
+
"name": "punctuation.definition.template-expression.begin"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"end": "\\)",
|
|
81
|
+
"endCaptures": {
|
|
82
|
+
"0": {
|
|
83
|
+
"name": "punctuation.definition.template-expression.end"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"patterns": [
|
|
87
|
+
{
|
|
88
|
+
"include": "$self"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"comment": {
|
|
97
|
+
"name": "comment",
|
|
98
|
+
"begin": "# ",
|
|
99
|
+
"end": "\\n"
|
|
100
|
+
},
|
|
101
|
+
"number": {
|
|
102
|
+
"patterns": [
|
|
103
|
+
{
|
|
104
|
+
"name": "constant.numeric",
|
|
105
|
+
"match": "(?<=^|[^\\w-])-?\\d+(?:\\.\\d+)?(?=$|[^\\w-])"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"function": {
|
|
110
|
+
"patterns": [
|
|
111
|
+
{
|
|
112
|
+
"name": "entity.name.function",
|
|
113
|
+
"match": "[a-z](?:[a-z]|[0-9]|-(?!-))*[a-z0-9]?(?= -\\d| +\\d|!| [a-z0-9\"\\[\\(])(?! with)"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "entity.name.function",
|
|
117
|
+
"match": "(?<=^\\s*)[a-z](?:[a-z]|[0-9]|-(?!-))*[a-z0-9]? ~ *(\\{)"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "entity.name.function",
|
|
121
|
+
"match": "(?:webapp|shape|text|media|tag)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "entity.name.function",
|
|
125
|
+
"match": "[a-z](?:[a-z]|[0-9]|-(?!-))*[a-z0-9]?(?=\\()"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"parameter": {
|
|
130
|
+
"patterns": [
|
|
131
|
+
{
|
|
132
|
+
"name": "",
|
|
133
|
+
"match": "[a-z](?:[a-z0-9-]*[a-z0-9])?(?=:)"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "",
|
|
137
|
+
"match": "[a-z](?:[a-z0-9-]*[a-z0-9])?(\\.)?[a-z](?:[a-z0-9-]*[a-z0-9])?(?=:)"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"scopeName": "source.utkrisht"
|
|
143
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Welcome to your VS Code Extension
|
|
2
|
+
|
|
3
|
+
## What's in the folder
|
|
4
|
+
|
|
5
|
+
* This folder contains all of the files necessary for your extension.
|
|
6
|
+
* `package.json` - this is the manifest file in which you declare your extension and command.
|
|
7
|
+
* The sample plugin registers a command and defines its title and command name. With this information VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
|
|
8
|
+
* `extension.js` - this is the main file where you will provide the implementation of your command.
|
|
9
|
+
* The file exports one function, `activate`, which is called the very first time your extension is activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
|
|
10
|
+
* We pass the function containing the implementation of the command as the second parameter to `registerCommand`.
|
|
11
|
+
|
|
12
|
+
## Get up and running straight away
|
|
13
|
+
|
|
14
|
+
* Press `F5` to open a new window with your extension loaded.
|
|
15
|
+
* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
|
|
16
|
+
* Set breakpoints in your code inside `extension.js` to debug your extension.
|
|
17
|
+
* Find output from your extension in the debug console.
|
|
18
|
+
|
|
19
|
+
## Make changes
|
|
20
|
+
|
|
21
|
+
* You can relaunch the extension from the debug toolbar after changing code in `extension.js`.
|
|
22
|
+
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
|
23
|
+
|
|
24
|
+
## Explore the API
|
|
25
|
+
|
|
26
|
+
* You can open the full set of our API when you open the file `node_modules/@types/vscode/index.d.ts`.
|
|
27
|
+
|
|
28
|
+
## Run tests
|
|
29
|
+
|
|
30
|
+
* Install the [Extension Test Runner](https://marketplace.visualstudio.com/items?itemName=ms-vscode.extension-test-runner)
|
|
31
|
+
* Open the Testing view from the activity bar and click the Run Test" button, or use the hotkey `Ctrl/Cmd + ; A`
|
|
32
|
+
* See the output of the test result in the Test Results view.
|
|
33
|
+
* Make changes to `test/extension.test.js` or create new test files inside the `test` folder.
|
|
34
|
+
* The provided test runner will only consider files matching the name pattern `**.test.js`.
|
|
35
|
+
* You can create folders inside the `test` folder to structure your tests any way you want.
|
|
36
|
+
|
|
37
|
+
## Go further
|
|
38
|
+
|
|
39
|
+
* [Follow UX guidelines](https://code.visualstudio.com/api/ux-guidelines/overview) to create extensions that seamlessly integrate with VS Code's native interface and patterns.
|
|
40
|
+
* [Publish your extension](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) on the VS Code extension marketplace.
|
|
41
|
+
* Automate builds by setting up [Continuous Integration](https://code.visualstudio.com/api/working-with-extensions/continuous-integration).
|
|
42
|
+
* Integrate to the [report issue](https://code.visualstudio.com/api/get-started/wrapping-up#issue-reporting) flow to get issue and feature requests reported by users.
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "utkrisht",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A unified language for the web.",
|
|
5
|
+
"homepage": "https://github.com/LadyBeGood/utkrisht#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/LadyBeGood/utkrisht/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/LadyBeGood/utkrisht.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "LadyBeGood",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": ".compiler/utkrisht.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
+
}
|
|
20
|
+
}
|