Skip to content

Commit 5f40720

Browse files
committed
feat: Add initial ProXPL lexer, syntax highlighting for VS Code, and a standard library test file.
1 parent 2ac6721 commit 5f40720

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

extension/syntaxes/proxpl.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"patterns": [
4747
{
4848
"name": "keyword.control.proxpl",
49-
"match": "\\b(if|else|while|for|return|use)\\b"
49+
"match": "\\b(if|else|while|for|return|import)\\b"
5050
},
5151
{
5252
"name": "keyword.declaration.proxpl",

include/scanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ typedef enum {
9999
TOKEN_ASYNC,
100100
TOKEN_AWAIT,
101101
TOKEN_USE,
102-
// TOKEN_IMPORT removed
102+
TOKEN_IMPORT,
103103
TOKEN_EXPORT,
104104
TOKEN_FROM,
105105
TOKEN_AS,

src/compiler/lexer/scanner.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ static PxTokenType identifierType(Scanner *scanner) {
276276
case 'p':
277277
if (scanner->current - scanner->start > 3) {
278278
switch (scanner->start[3]) {
279+
case 'o':
280+
return checkKeyword(scanner, 4, 2, "rt", TOKEN_IMPORT);
279281
case 'l':
280282
return checkKeyword(scanner, 4, 7, "ements", TOKEN_IMPLEMENTS);
281283
}

tests/stdlib_test.prox

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Functional Test for ProXPL Stdlib v0.1
22

3-
use std.io;
4-
use std.fs;
5-
use std.sys;
6-
use std.core;
3+
import std.io;
4+
import std.fs;
5+
import std.sys;
6+
import std.core;
77

88
// Test std.core
99
print("Testing std.core...");

0 commit comments

Comments
 (0)