better syntax highlighting for vscode

This commit is contained in:
cozis
2022-12-07 14:35:57 +01:00
parent a92e8a71cc
commit 16ecd28dd9
2 changed files with 11 additions and 44 deletions
-37
View File
@@ -1,37 +0,0 @@
fun compareAny(A, B) {
fun compareLists(A: List, B: List) {
n = count(A);
if n != count(B):
return false;
i = 0;
while i < n: {
if not compareAny(A[i], B[i]):
return false;
i = i + 1;
}
return true;
}
T = type(A);
if T != type(B):
return false;
if T == List:
return compareLists(A, B);
if T == Map:
error("Maps aren't supported yet!");
return A == B;
}
assert(compareAny(1, 2) == false);
assert(compareAny([], []) == true);
assert(compareAny([], [1]) == false);
assert(compareAny([1, 2, 3], [1, 2, 3]) == true);
assert(compareAny([1, 2, 3], [1, 2, 4]) == false);
assert(compareAny([1, 2, 3], [1, 2, 3, 4]) == false);
@@ -9,18 +9,18 @@
{ {
"match": "\\b(fun)\\b[ \\t\\n]*([a-zA-Z_][a-zA-Z0-9_]*)?\\b", "match": "\\b(fun)\\b[ \\t\\n]*([a-zA-Z_][a-zA-Z0-9_]*)?\\b",
"captures": { "captures": {
"1": {"name": "keyword.control.noja"}, "1": {"name": "storage.type.function.noja"},
"2": {"name": "entity.name.function"} "2": {"name": "entity.name.function"}
} }
}, },
{
"name": "keyword.operator.word.noja",
"match": "\\b(and|or|not)\\b"
},
{ {
"name": "keyword.operator.noja", "name": "keyword.operator.noja",
"match": "(\\+|-|\\*|\\/|=|==|!=|\\>|\\<|\\>=|\\<=|\\|)" "match": "(\\+|-|\\*|\\/|=|==|!=|\\>|\\<|\\>=|\\<=|\\|)"
}, },
{
"name": "keyword.operator.logical.noja",
"match": "\\b(and|or|not)\\b"
},
{ {
"name": "constant.language.noja", "name": "constant.language.noja",
"match": "\\b(none|any|true|false)\\b" "match": "\\b(none|any|true|false)\\b"
@@ -56,13 +56,17 @@
"match": "[0-9]+" "match": "[0-9]+"
}, },
{ {
"name": "storage.type.noja", "name": "support.type.noja",
"match": "\\b(int|float|bool|[_A-Z][A-Za-z0-9_]*)\\b" "match": "\\b(int|float|bool|[_A-Z][A-Za-z0-9_]*)\\b"
}, },
{
"name": "support.function.builtin.noja",
"match": "\\b(import|type|istypeof|print|input|count|error|assert|keysof)\\b"
},
{ {
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)[ \\t\\n]*\\(", "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)[ \\t\\n]*\\(",
"captures": { "captures": {
"1": {"name": "variable.function.noja"} "1": {"name": "variable.other.function"}
} }
}, },
{ {