Skip to content

Commit bec4b51

Browse files
committed
implement try/catch, still need to implement in every error
1 parent fd32156 commit bec4b51

20 files changed

Lines changed: 6258 additions & 5003 deletions

File tree

extensions/vscode/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "modu-lang",
33
"displayName": "Modu Lang",
44
"description": "Syntax highlightning for the Modu Programming Language",
5-
"version": "1.8.0",
5+
"version": "1.9.0",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/cyteon/modu"
@@ -20,7 +20,7 @@
2020
],
2121
"scripts": {
2222
"test-vscode": "vscode-test",
23-
"install": "vsce package && code --install-extension ./modu-lang-1.8.0.vsix",
23+
"install": "vsce package && code --install-extension ./modu-lang-1.9.0.vsix",
2424
"vsce": "vsce package",
2525
"test": "npm run vsce && npm run install"
2626
},

extensions/vscode/syntaxes/modu.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"keywords": {
2020
"patterns": [{
2121
"name": "keyword.control.modu",
22-
"match": "\\b(if|else|fn|let|const|import|as|return|loop|break|continue|for|while|and|or|in|not in|class|self)\\b"
22+
"match": "\\b(if|else|fn|let|const|import|as|return|loop|break|continue|for|while|and|or|in|not in|class|self|try|catch)\\b"
2323
}]
2424
},
2525

extensions/zed/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ repository = "https://github.com/cyteon/modu"
88

99
[grammars.modu]
1010
repository = "https://github.com/cyteon/tree-sitter-modu"
11-
rev = "4f09a0c8fa29e836876d3ae30ca1c6ddda00e567"
11+
rev = "e84f411c28e4792066dc3bf19015c48d9adc5e1a"

extensions/zed/grammars/modu.wasm

2.69 KB
Binary file not shown.

extensions/zed/grammars/modu/grammar.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = grammar({
2222
$.break_stmt,
2323
$.continue_stmt,
2424
$.import_stmt,
25+
$.try_stmt,
2526
$._expression,
2627
),
2728

@@ -55,6 +56,9 @@ module.exports = grammar({
5556
"continue",
5657
import_stmt: ($) =>
5758
seq("import", $.string, optional(seq("as", $.identifier))),
59+
try_stmt: ($) =>
60+
seq("try", $._block, "catch", $.identifier, $._block),
61+
5862

5963
_block: ($) => seq("{", repeat($._statement), "}"),
6064

@@ -133,4 +137,4 @@ module.exports = grammar({
133137

134138
function commaSeperated(rule) {
135139
return seq(rule, repeat(seq(",", rule)), optional(","));
136-
}
140+
}

extensions/zed/grammars/modu/src/grammar.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"type": "SYMBOL",
1818
"name": "let_stmt"
1919
},
20+
{
21+
"type": "SYMBOL",
22+
"name": "const_stmt"
23+
},
2024
{
2125
"type": "SYMBOL",
2226
"name": "assign_stmt"
@@ -61,6 +65,10 @@
6165
"type": "SYMBOL",
6266
"name": "import_stmt"
6367
},
68+
{
69+
"type": "SYMBOL",
70+
"name": "try_stmt"
71+
},
6472
{
6573
"type": "SYMBOL",
6674
"name": "_expression"
@@ -88,6 +96,27 @@
8896
}
8997
]
9098
},
99+
"const_stmt": {
100+
"type": "SEQ",
101+
"members": [
102+
{
103+
"type": "STRING",
104+
"value": "const"
105+
},
106+
{
107+
"type": "SYMBOL",
108+
"name": "identifier"
109+
},
110+
{
111+
"type": "STRING",
112+
"value": "="
113+
},
114+
{
115+
"type": "SYMBOL",
116+
"name": "_expression"
117+
}
118+
]
119+
},
91120
"assign_stmt": {
92121
"type": "SEQ",
93122
"members": [
@@ -429,6 +458,31 @@
429458
}
430459
]
431460
},
461+
"try_stmt": {
462+
"type": "SEQ",
463+
"members": [
464+
{
465+
"type": "STRING",
466+
"value": "try"
467+
},
468+
{
469+
"type": "SYMBOL",
470+
"name": "_block"
471+
},
472+
{
473+
"type": "STRING",
474+
"value": "catch"
475+
},
476+
{
477+
"type": "SYMBOL",
478+
"name": "identifier"
479+
},
480+
{
481+
"type": "SYMBOL",
482+
"name": "_block"
483+
}
484+
]
485+
},
432486
"_block": {
433487
"type": "SEQ",
434488
"members": [

0 commit comments

Comments
 (0)