Skip to content

Commit 8741677

Browse files
committed
feat: Add initial implementation of ProXPL language compiler, runtime, standard library, and tooling.
1 parent 0cfeacf commit 8741677

39 files changed

Lines changed: 0 additions & 1459 deletions

extension/snippets/proxpl-snippets.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"}"
3030
],
3131
"description": "If block"
32-
<<<<<<< HEAD
3332
},
3433
"For Loop": {
3534
"prefix": "for",
@@ -86,7 +85,5 @@
8685
"}"
8786
],
8887
"description": "Try-Catch block"
89-
=======
90-
>>>>>>> fix-ci-build
9188
}
9289
}

extension/src/extension.ts

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as vscode from 'vscode';
22
import * as cp from 'child_process';
3-
<<<<<<< HEAD
43
import * as path from 'path';
54
import {
65
LanguageClient,
@@ -10,14 +9,11 @@ import {
109
} from 'vscode-languageclient/node';
1110

1211
let client: LanguageClient;
13-
=======
14-
>>>>>>> fix-ci-build
1512

1613
export function activate(context: vscode.ExtensionContext) {
1714
const diagnosticCollection = vscode.languages.createDiagnosticCollection('proxpl');
1815
context.subscriptions.push(diagnosticCollection);
1916

20-
<<<<<<< HEAD
2117
vscode.window.showInformationMessage('ProX Studio Alpha started.');
2218

2319
// --- LSP Client Setup ---
@@ -54,8 +50,6 @@ export function activate(context: vscode.ExtensionContext) {
5450
client.start();
5551

5652

57-
=======
58-
>>>>>>> fix-ci-build
5953
// 1. Code Runner Command
6054
let runCommand = vscode.commands.registerCommand('proxpl.run', () => {
6155
const editor = vscode.window.activeTextEditor;
@@ -65,13 +59,8 @@ export function activate(context: vscode.ExtensionContext) {
6559
}
6660

6761
const fileName = editor.document.fileName;
68-
<<<<<<< HEAD
6962
if (!fileName.endsWith('.prox') && !fileName.endsWith('.pxpl')) {
7063
vscode.window.showErrorMessage('Not a ProXPL (.prox or .pxpl) file.');
71-
=======
72-
if (!fileName.endsWith('.prox')) {
73-
vscode.window.showErrorMessage('Not a ProXPL (.prox) file.');
74-
>>>>>>> fix-ci-build
7564
return;
7665
}
7766

@@ -91,7 +80,6 @@ export function activate(context: vscode.ExtensionContext) {
9180

9281
// Save file before running
9382
editor.document.save().then(() => {
94-
<<<<<<< HEAD
9583
let terminal = vscode.window.terminals.find(t => t.name === 'ProXPL');
9684
if (!terminal) {
9785
terminal = vscode.window.createTerminal('ProXPL');
@@ -107,79 +95,6 @@ export function activate(context: vscode.ExtensionContext) {
10795
// ... (intermediate code skipped) ...
10896

10997
// 4. Hover Support
110-
=======
111-
const terminal = vscode.window.activeTerminal || vscode.window.createTerminal('ProXPL');
112-
terminal.show();
113-
terminal.sendText(`proxpl run "${fileName}"`);
114-
115-
// Background execution for diagnostics
116-
cp.exec(`proxpl check "${fileName}"`, (error: Error | null, stdout: string, stderr: string) => {
117-
diagnosticCollection.clear();
118-
const diagnostics: vscode.Diagnostic[] = [];
119-
const errorLog = stderr || stdout;
120-
const errorLines = errorLog.split('\n');
121-
122-
errorLines.forEach((line: string) => {
123-
const match = line.match(/Error at line (\d+): (.*)/);
124-
if (match) {
125-
const lineNum = mapLineNumber(match[1]);
126-
const message = match[2];
127-
const range = new vscode.Range(lineNum, 0, lineNum, 100);
128-
diagnostics.push(new vscode.Diagnostic(range, message, vscode.DiagnosticSeverity.Error));
129-
}
130-
});
131-
132-
diagnosticCollection.set(editor.document.uri, diagnostics);
133-
});
134-
});
135-
});
136-
});
137-
context.subscriptions.push(runCommand);
138-
139-
// 2. Formatter Provider
140-
const formattingProvider = vscode.languages.registerDocumentFormattingEditProvider('proxpl', {
141-
provideDocumentFormattingEdits(document: vscode.TextDocument): vscode.TextEdit[] {
142-
const edits: vscode.TextEdit[] = [];
143-
let lastLineWasEmpty = false;
144-
145-
for (let i = 0; i < document.lineCount; i++) {
146-
const line = document.lineAt(i);
147-
const text = line.text;
148-
149-
// 1. Remove extra empty lines (consecutive empty lines)
150-
if (text.trim() === '') {
151-
if (lastLineWasEmpty) {
152-
// Delete this extra empty line
153-
edits.push(vscode.TextEdit.delete(line.rangeIncludingLineBreak));
154-
continue;
155-
}
156-
lastLineWasEmpty = true;
157-
} else {
158-
lastLineWasEmpty = false;
159-
}
160-
161-
// 2. Remove trailing whitespace
162-
if (text.endsWith(' ') || text.endsWith('\t')) {
163-
edits.push(vscode.TextEdit.delete(new vscode.Range(i, text.trimEnd().length, i, text.length)));
164-
}
165-
166-
// 3. Basic Indentation (Fix to 4 spaces)
167-
const indentMatch = text.match(/^(\s+)/);
168-
if (indentMatch) {
169-
const oldIndent = indentMatch[1];
170-
const newIndent = oldIndent.replace(/\t/g, ' ');
171-
if (oldIndent !== newIndent) {
172-
edits.push(vscode.TextEdit.replace(new vscode.Range(i, 0, i, oldIndent.length), newIndent));
173-
}
174-
}
175-
}
176-
return edits;
177-
}
178-
});
179-
context.subscriptions.push(formattingProvider);
180-
181-
// 3. Hover Support
182-
>>>>>>> fix-ci-build
18398
const hoverProvider = vscode.languages.registerHoverProvider('proxpl', {
18499
provideHover(document: vscode.TextDocument, position: vscode.Position) {
185100
const range = document.getWordRangeAtPosition(position);
@@ -188,7 +103,6 @@ export function activate(context: vscode.ExtensionContext) {
188103

189104
const descriptions: { [key: string]: string } = {
190105
'func': 'Defines a new function in ProXPL. Syntax: `func name(params) { ... }`',
191-
<<<<<<< HEAD
192106
'var': 'Declares a new variable.',
193107
'let': 'Declares a mutable variable.',
194108
'const': 'Declares an immutable constant.',
@@ -220,15 +134,6 @@ export function activate(context: vscode.ExtensionContext) {
220134
'try': 'Starts a block of code to test for errors.',
221135
'catch': 'Handles errors thrown in the try block.',
222136
'throw': 'Throws an error/exception.'
223-
=======
224-
'var': 'Declares a new variable. ProXPL is dynamically typed but variables must be declared.',
225-
'if': 'Conditional statement. Executes a block if the condition is true.',
226-
'else': 'Defines an alternative block for an `if` statement.',
227-
'while': 'Loop that continues as long as a condition is true.',
228-
'return': 'Exits a function and optionally returns a value.',
229-
'print': 'Built-in function to output values to the terminal.',
230-
'import': 'Incorporates external modules into the current script.'
231-
>>>>>>> fix-ci-build
232137
};
233138

234139
if (descriptions[word]) {
@@ -238,7 +143,6 @@ export function activate(context: vscode.ExtensionContext) {
238143
}
239144
});
240145
context.subscriptions.push(hoverProvider);
241-
<<<<<<< HEAD
242146

243147
// 5. Definition Provider (Basic "Go to Definition")
244148
const definitionProvider = vscode.languages.registerDefinitionProvider('proxpl', {
@@ -326,22 +230,16 @@ class ProXDebugAdapter implements vscode.DebugAdapter {
326230
dispose() {
327231

328232
}
329-
=======
330-
>>>>>>> fix-ci-build
331233
}
332234

333235
function mapLineNumber(lineStr: string): number {
334236
const num = parseInt(lineStr);
335237
return isNaN(num) ? 0 : num - 1;
336238
}
337239

338-
<<<<<<< HEAD
339240
export function deactivate(): Thenable<void> | undefined {
340241
if (!client) {
341242
return undefined;
342243
}
343244
return client.stop();
344245
}
345-
=======
346-
export function deactivate() { }
347-
>>>>>>> fix-ci-build

extension/syntaxes/proxpl.tmLanguage.json

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@
1010
"include": "#keywords"
1111
},
1212
{
13-
<<<<<<< HEAD
1413
"include": "#storage"
1514
},
1615
{
17-
=======
18-
>>>>>>> fix-ci-build
1916
"include": "#types"
2017
},
2118
{
@@ -32,15 +29,12 @@
3229
},
3330
{
3431
"include": "#functions"
35-
<<<<<<< HEAD
3632
},
3733
{
3834
"include": "#classes"
3935
},
4036
{
4137
"include": "#constants"
42-
=======
43-
>>>>>>> fix-ci-build
4438
}
4539
],
4640
"repository": {
@@ -61,7 +55,6 @@
6155
"patterns": [
6256
{
6357
"name": "keyword.control.proxpl",
64-
<<<<<<< HEAD
6558
"match": "\\b(if|else|while|for|return|break|continue|switch|case|default|try|catch|finally|throw|await|async|defer|use|from|export)\\b"
6659
},
6760
{
@@ -83,26 +76,14 @@
8376
{
8477
"name": "storage.modifier.proxpl",
8578
"match": "\\b(public|private|protected|static|abstract|native|async)\\b"
86-
=======
87-
"match": "\\b(if|else|while|for|return|import)\\b"
88-
},
89-
{
90-
"name": "keyword.declaration.proxpl",
91-
"match": "\\b(var|func)\\b"
92-
>>>>>>> fix-ci-build
9379
}
9480
]
9581
},
9682
"types": {
9783
"patterns": [
9884
{
99-
<<<<<<< HEAD
10085
"name": "storage.type.primitive.proxpl",
10186
"match": "\\b(void|int|float|string|bool)\\b"
102-
=======
103-
"name": "storage.type.proxpl",
104-
"match": "\\b(int|float|string|bool)\\b"
105-
>>>>>>> fix-ci-build
10687
}
10788
]
10889
},
@@ -124,32 +105,23 @@
124105
"numbers": {
125106
"patterns": [
126107
{
127-
<<<<<<< HEAD
128108
"name": "constant.numeric.hex.proxpl",
129109
"match": "\\b0x[a-fA-F0-9]+\\b"
130110
},
131111
{
132112
"name": "constant.numeric.decimal.proxpl",
133-
=======
134-
"name": "constant.numeric.proxpl",
135-
>>>>>>> fix-ci-build
136113
"match": "\\b[0-9]+(\\.[0-9]+)?\\b"
137114
}
138115
]
139116
},
140117
"booleans": {
141118
"patterns": [
142119
{
143-
<<<<<<< HEAD
144120
"name": "constant.language.boolean.proxpl",
145-
=======
146-
"name": "constant.language.proxpl",
147-
>>>>>>> fix-ci-build
148121
"match": "\\b(true|false)\\b"
149122
}
150123
]
151124
},
152-
<<<<<<< HEAD
153125
"constants": {
154126
"patterns": [
155127
{
@@ -158,17 +130,11 @@
158130
}
159131
]
160132
},
161-
=======
162-
>>>>>>> fix-ci-build
163133
"operators": {
164134
"patterns": [
165135
{
166136
"name": "keyword.operator.proxpl",
167-
<<<<<<< HEAD
168137
"match": "(\\+|\\-|\\*|\\/|%|\\^|&|\\||!|==|!=|>|<|=)"
169-
=======
170-
"match": "(\\+|\\-|\\*|\\/|==|!=|>|<|=)"
171-
>>>>>>> fix-ci-build
172138
}
173139
]
174140
},
@@ -183,7 +149,6 @@
183149
"match": "\\b(print)\\b"
184150
}
185151
]
186-
<<<<<<< HEAD
187152
},
188153
"classes": {
189154
"patterns": [
@@ -199,8 +164,6 @@
199164
}
200165
}
201166
]
202-
=======
203-
>>>>>>> fix-ci-build
204167
}
205168
}
206169
}

0 commit comments

Comments
 (0)