@devaloop/devalang 0.0.1-alpha.9 → 0.0.1-beta.2
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/.cargo/config.toml +2 -0
- package/.devalang +6 -1
- package/.github/workflows/ci.yml +103 -0
- package/Cargo.toml +81 -48
- package/README.md +137 -154
- package/docs/CHANGELOG.md +428 -1
- package/docs/CONTRIBUTING.md +101 -0
- package/docs/ROADMAP.md +14 -7
- package/docs/TODO.md +16 -15
- package/examples/automation.deva +42 -0
- package/examples/bank.deva +7 -0
- package/examples/bus.deva +10 -0
- package/examples/duration.deva +9 -0
- package/examples/effect.deva +2 -0
- package/examples/events.deva +12 -0
- package/examples/filter.deva +11 -0
- package/examples/function.deva +15 -0
- package/examples/index.deva +57 -12
- package/examples/lfo.deva +9 -0
- package/examples/loop.deva +5 -12
- package/examples/pattern.deva +8 -0
- package/examples/plugin.deva +16 -0
- package/examples/synth.deva +11 -1
- package/examples/synth_types.deva +17 -0
- package/examples/variables.deva +1 -1
- package/out-tsc/bin/index.d.ts +2 -0
- package/out-tsc/bin/index.js +51 -7
- package/out-tsc/core/functions/index.d.ts +42 -0
- package/out-tsc/core/functions/index.js +87 -0
- package/out-tsc/core/index.d.ts +6 -0
- package/out-tsc/core/index.js +22 -0
- package/out-tsc/core/types/index.d.ts +4 -0
- package/out-tsc/core/types/index.js +20 -0
- package/out-tsc/core/types/plugin.d.ts +18 -0
- package/out-tsc/core/types/plugin.js +2 -0
- package/out-tsc/core/types/result.d.ts +27 -0
- package/out-tsc/core/types/result.js +2 -0
- package/out-tsc/core/types/statement.d.ts +106 -0
- package/out-tsc/core/types/statement.js +2 -0
- package/out-tsc/core/types/value.d.ts +43 -0
- package/out-tsc/core/types/value.js +2 -0
- package/out-tsc/index.d.ts +7 -0
- package/out-tsc/index.js +42 -1
- package/out-tsc/pkg/devalang_core.d.ts +15 -0
- package/out-tsc/pkg/devalang_core.js +65 -0
- package/out-tsc/pkg/devalang_core_bg.wasm.d.ts +34 -0
- package/out-tsc/scripts/copy-wasm-dts.d.ts +1 -0
- package/out-tsc/scripts/copy-wasm-dts.js +73 -0
- package/out-tsc/scripts/postinstall.d.ts +1 -0
- package/out-tsc/scripts/postinstall.js +83 -0
- package/out-tsc/scripts/version/bump.d.ts +1 -0
- package/out-tsc/scripts/version/fetch.d.ts +1 -0
- package/out-tsc/scripts/version/index.d.ts +1 -0
- package/out-tsc/scripts/version/sync.d.ts +1 -0
- package/package.json +28 -7
- package/project-version.json +4 -4
- package/rust/cli/bank/api.rs +122 -0
- package/rust/cli/bank/commands.rs +306 -0
- package/rust/cli/bank/mod.rs +29 -0
- package/rust/cli/build/commands.rs +153 -0
- package/rust/cli/build/mod.rs +2 -0
- package/rust/cli/build/process.rs +165 -0
- package/rust/cli/check/mod.rs +208 -0
- package/rust/cli/discover/commands.rs +253 -0
- package/rust/cli/discover/config.rs +111 -0
- package/rust/cli/discover/fs.rs +19 -0
- package/rust/cli/discover/install.rs +103 -0
- package/rust/cli/discover/metadata.rs +48 -0
- package/rust/cli/discover/mod.rs +5 -0
- package/rust/cli/{init.rs → init/commands.rs} +32 -23
- package/rust/cli/init/mod.rs +1 -0
- package/rust/cli/install/addon.rs +118 -0
- package/rust/cli/install/bank.rs +72 -0
- package/rust/cli/install/commands.rs +35 -0
- package/rust/cli/install/mod.rs +4 -0
- package/rust/cli/install/plugin.rs +80 -0
- package/rust/cli/login/commands.rs +124 -0
- package/rust/cli/login/mod.rs +1 -0
- package/rust/cli/mod.rs +9 -202
- package/rust/cli/parser.rs +359 -0
- package/rust/cli/play/commands.rs +375 -0
- package/rust/cli/play/io.rs +17 -0
- package/rust/cli/play/mod.rs +5 -0
- package/rust/cli/play/process.rs +159 -0
- package/rust/cli/play/realtime.rs +91 -0
- package/rust/cli/play/utils.rs +23 -0
- package/rust/cli/telemetry/commands.rs +22 -0
- package/rust/cli/telemetry/event_creator.rs +80 -0
- package/rust/cli/telemetry/mod.rs +3 -0
- package/rust/cli/telemetry/send.rs +51 -0
- package/rust/cli/{template.rs → template/commands.rs} +17 -5
- package/rust/cli/template/mod.rs +1 -0
- package/rust/cli/update/commands.rs +6 -0
- package/rust/cli/update/mod.rs +1 -0
- package/rust/config/driver.rs +112 -0
- package/rust/config/mod.rs +3 -16
- package/rust/config/ops.rs +26 -0
- package/rust/config/settings.rs +101 -0
- package/rust/core/audio/engine/driver.rs +220 -0
- package/rust/core/audio/engine/export.rs +169 -0
- package/rust/core/audio/engine/helpers.rs +178 -0
- package/rust/core/audio/engine/mod.rs +56 -0
- package/rust/core/audio/engine/notes/dsp.rs +85 -0
- package/rust/core/audio/engine/notes/mod.rs +44 -0
- package/rust/core/audio/engine/notes/params.rs +294 -0
- package/rust/core/audio/engine/sample/insert.rs +199 -0
- package/rust/core/audio/engine/sample/mod.rs +40 -0
- package/rust/core/audio/engine/sample/padding.rs +170 -0
- package/rust/core/audio/evaluator/condition.rs +61 -0
- package/rust/core/audio/evaluator/mod.rs +9 -0
- package/rust/core/audio/evaluator/numeric.rs +152 -0
- package/rust/core/audio/evaluator/rhs.rs +16 -0
- package/rust/core/audio/evaluator/string_expr.rs +94 -0
- package/rust/core/audio/interpreter/driver.rs +574 -216
- package/rust/core/audio/interpreter/mod.rs +2 -12
- package/rust/core/audio/interpreter/statements/arrow_call/interprete.rs +175 -0
- package/rust/core/audio/interpreter/statements/arrow_call/methods/chord.rs +384 -0
- package/rust/core/audio/interpreter/statements/arrow_call/methods/mod.rs +2 -0
- package/rust/core/audio/interpreter/statements/arrow_call/methods/note.rs +316 -0
- package/rust/core/audio/interpreter/statements/arrow_call/mod.rs +3 -0
- package/rust/core/audio/interpreter/statements/arrow_call/types/arp.rs +192 -0
- package/rust/core/audio/interpreter/statements/arrow_call/types/mod.rs +24 -0
- package/rust/core/audio/interpreter/statements/arrow_call/types/pad.rs +116 -0
- package/rust/core/audio/interpreter/statements/arrow_call/types/pluck.rs +97 -0
- package/rust/core/audio/interpreter/statements/arrow_call/types/sub.rs +100 -0
- package/rust/core/audio/interpreter/statements/automate.rs +16 -0
- package/rust/core/audio/interpreter/statements/call.rs +295 -0
- package/rust/core/audio/interpreter/{condition.rs → statements/condition.rs} +72 -69
- package/rust/core/audio/interpreter/statements/function.rs +24 -0
- package/rust/core/audio/interpreter/statements/let_.rs +36 -0
- package/rust/core/audio/interpreter/statements/load.rs +17 -0
- package/rust/core/audio/interpreter/statements/loop_.rs +115 -0
- package/rust/core/audio/interpreter/statements/mod.rs +12 -0
- package/rust/core/audio/interpreter/statements/sleep.rs +28 -0
- package/rust/core/audio/interpreter/statements/spawn.rs +253 -0
- package/rust/core/audio/interpreter/statements/tempo.rs +40 -0
- package/rust/core/audio/interpreter/statements/trigger.rs +239 -0
- package/rust/core/audio/loader/mod.rs +1 -1
- package/rust/core/audio/loader/trigger.rs +98 -52
- package/rust/core/audio/mod.rs +2 -2
- package/rust/core/audio/player.rs +28 -12
- package/rust/core/audio/special/easing.rs +189 -0
- package/rust/core/audio/special/env.rs +45 -0
- package/rust/core/audio/special/math.rs +134 -0
- package/rust/core/audio/special/mod.rs +9 -0
- package/rust/core/audio/special/modulator.rs +143 -0
- package/rust/core/builder/mod.rs +129 -80
- package/rust/core/debugger/lexer.rs +4 -4
- package/rust/core/debugger/logs.rs +52 -0
- package/rust/core/debugger/mod.rs +11 -2
- package/rust/core/debugger/preprocessor.rs +4 -4
- package/rust/core/debugger/store.rs +38 -25
- package/rust/core/error/mod.rs +221 -12
- package/rust/core/lexer/driver.rs +59 -0
- package/rust/core/lexer/handler/arrow.rs +62 -11
- package/rust/core/lexer/handler/at.rs +5 -5
- package/rust/core/lexer/handler/brace.rs +11 -11
- package/rust/core/lexer/handler/colon.rs +5 -5
- package/rust/core/lexer/handler/comment.rs +3 -3
- package/rust/core/lexer/handler/dot.rs +6 -6
- package/rust/core/lexer/handler/driver.rs +143 -32
- package/rust/core/lexer/handler/identifier.rs +11 -5
- package/rust/core/lexer/handler/indent.rs +18 -4
- package/rust/core/lexer/handler/mod.rs +6 -5
- package/rust/core/lexer/handler/newline.rs +3 -3
- package/rust/core/lexer/handler/number.rs +5 -5
- package/rust/core/lexer/handler/operator.rs +5 -3
- package/rust/core/lexer/handler/parenthesis.rs +41 -0
- package/rust/core/lexer/handler/slash.rs +21 -0
- package/rust/core/lexer/handler/string.rs +3 -3
- package/rust/core/lexer/mod.rs +1 -49
- package/rust/core/lexer/token.rs +17 -12
- package/rust/core/mod.rs +9 -10
- package/rust/core/parser/driver/block.rs +111 -0
- package/rust/core/parser/driver/cursor.rs +82 -0
- package/rust/core/parser/driver/driver_impl.rs +139 -0
- package/rust/core/parser/driver/mod.rs +6 -0
- package/rust/core/parser/driver/parse_array.rs +120 -0
- package/rust/core/parser/driver/parse_map.rs +223 -0
- package/rust/core/parser/driver/parser.rs +160 -0
- package/rust/core/parser/handler/arrow_call.rs +277 -126
- package/rust/core/parser/handler/at.rs +142 -25
- package/rust/core/parser/handler/bank.rs +83 -20
- package/rust/core/parser/handler/condition.rs +14 -5
- package/rust/core/parser/handler/dot.rs +111 -75
- package/rust/core/parser/handler/identifier/automate.rs +254 -0
- package/rust/core/parser/handler/identifier/call.rs +74 -24
- package/rust/core/parser/handler/identifier/emit.rs +70 -0
- package/rust/core/parser/handler/identifier/function.rs +113 -0
- package/rust/core/parser/handler/identifier/group.rs +28 -14
- package/rust/core/parser/handler/identifier/let_.rs +61 -21
- package/rust/core/parser/handler/identifier/mod.rs +24 -20
- package/rust/core/parser/handler/identifier/on.rs +107 -0
- package/rust/core/parser/handler/identifier/print.rs +49 -0
- package/rust/core/parser/handler/identifier/sleep.rs +77 -14
- package/rust/core/parser/handler/identifier/spawn.rs +81 -31
- package/rust/core/parser/handler/identifier/synth.rs +102 -32
- package/rust/core/parser/handler/loop_.rs +144 -22
- package/rust/core/parser/handler/mod.rs +6 -5
- package/rust/core/parser/handler/pattern.rs +74 -0
- package/rust/core/parser/handler/tempo.rs +67 -9
- package/rust/core/parser/mod.rs +3 -4
- package/rust/core/parser/statement.rs +6 -92
- package/rust/core/plugin/loader.rs +137 -0
- package/rust/core/plugin/mod.rs +2 -0
- package/rust/core/plugin/runner/mod.rs +11 -0
- package/rust/core/plugin/runner/non_wasm.rs +297 -0
- package/rust/core/plugin/runner/wasm32.rs +43 -0
- package/rust/core/preprocessor/loader/inject.rs +278 -0
- package/rust/core/preprocessor/loader/loader_helpers.rs +110 -0
- package/rust/core/preprocessor/loader/mod.rs +235 -0
- package/rust/core/preprocessor/mod.rs +4 -4
- package/rust/core/preprocessor/module.rs +55 -50
- package/rust/core/preprocessor/processor/handlers.rs +107 -0
- package/rust/core/preprocessor/processor/mod.rs +1 -0
- package/rust/core/preprocessor/resolver/bank.rs +14 -12
- package/rust/core/preprocessor/resolver/call.rs +106 -105
- package/rust/core/preprocessor/resolver/condition.rs +13 -10
- package/rust/core/preprocessor/resolver/driver.rs +145 -48
- package/rust/core/preprocessor/resolver/function.rs +69 -0
- package/rust/core/preprocessor/resolver/group.rs +122 -61
- package/rust/core/preprocessor/resolver/let_.rs +13 -12
- package/rust/core/preprocessor/resolver/loop_.rs +240 -13
- package/rust/core/preprocessor/resolver/mod.rs +8 -6
- package/rust/core/preprocessor/resolver/pattern.rs +83 -0
- package/rust/core/preprocessor/resolver/spawn.rs +83 -42
- package/rust/core/preprocessor/resolver/synth.rs +15 -11
- package/rust/core/preprocessor/resolver/tempo.rs +13 -14
- package/rust/core/preprocessor/resolver/trigger.rs +32 -28
- package/rust/core/preprocessor/resolver/value.rs +111 -13
- package/rust/core/store/global.rs +57 -39
- package/rust/core/store/mod.rs +0 -3
- package/rust/lib.rs +323 -117
- package/rust/main.rs +388 -65
- package/rust/types/Cargo.toml +11 -0
- package/rust/types/src/addons.rs +55 -0
- package/rust/types/src/ast.rs +202 -0
- package/rust/types/src/config.rs +84 -0
- package/rust/types/src/lib.rs +15 -0
- package/rust/types/src/plugin.rs +20 -0
- package/rust/types/src/store.rs +139 -0
- package/rust/types/src/telemetry.rs +85 -0
- package/rust/utils/Cargo.toml +26 -0
- package/rust/utils/src/error.rs +186 -0
- package/rust/utils/src/file.rs +94 -0
- package/rust/utils/src/first_usage.rs +97 -0
- package/rust/utils/{mod.rs → src/lib.rs} +6 -3
- package/rust/utils/{logger.rs → src/logger.rs} +94 -17
- package/rust/utils/src/path.rs +129 -0
- package/rust/utils/src/signature.rs +41 -0
- package/rust/utils/{spinner.rs → src/spinner.rs} +7 -8
- package/rust/utils/src/version.rs +27 -0
- package/rust/utils/{watcher.rs → src/watcher.rs} +17 -4
- package/rust/web/api.rs +5 -0
- package/rust/web/cdn.rs +34 -0
- package/rust/web/mod.rs +3 -0
- package/rust/web/sso.rs +5 -0
- package/templates/minimal/README.md +143 -127
- package/templates/welcome/README.md +143 -127
- package/templates/welcome/src/index.deva +56 -8
- package/templates/welcome/src/variables.deva +2 -4
- package/tests/integration.rs +21 -0
- package/tests/rust/cli_check_build.rs +21 -0
- package/tests/rust/cli_help.rs +12 -0
- package/tests/rust/cli_template_list.rs +10 -0
- package/tests/rust/cli_version.rs +11 -0
- package/tests/typescript/index.spec.ts +136 -0
- package/tests/typescript/playhead.spec.ts +36 -0
- package/tests/typescript/render_e2e.spec.ts +77 -0
- package/tsconfig.json +12 -10
- package/typescript/bin/index.ts +19 -5
- package/typescript/core/functions/index.ts +94 -0
- package/typescript/core/index.ts +6 -0
- package/typescript/core/types/index.ts +4 -0
- package/typescript/core/types/plugin.ts +19 -0
- package/typescript/core/types/result.ts +29 -0
- package/typescript/core/types/statement.ts +47 -0
- package/typescript/core/types/value.ts +29 -0
- package/typescript/index.ts +8 -1
- package/typescript/pkg/devalang_core.d.ts +4 -0
- package/typescript/pkg/devalang_core.ts +65 -0
- package/typescript/scripts/copy-wasm-dts.ts +41 -0
- package/typescript/scripts/postinstall.ts +85 -0
- package/typescript/scripts/version/bump.ts +0 -1
- package/typescript/scripts/version/index.ts +0 -1
- package/docs/COMMANDS.md +0 -85
- package/docs/CONFIG.md +0 -30
- package/docs/SYNTAX.md +0 -210
- package/out-tsc/bin/devalang.exe +0 -0
- package/out-tsc/scripts/postbuild.js +0 -11
- package/rust/cli/build.rs +0 -137
- package/rust/cli/check.rs +0 -117
- package/rust/cli/play.rs +0 -193
- package/rust/config/loader.rs +0 -13
- package/rust/core/audio/engine.rs +0 -203
- package/rust/core/audio/evaluator.rs +0 -31
- package/rust/core/audio/interpreter/arrow_call.rs +0 -129
- package/rust/core/audio/interpreter/call.rs +0 -64
- package/rust/core/audio/interpreter/let_.rs +0 -19
- package/rust/core/audio/interpreter/load.rs +0 -18
- package/rust/core/audio/interpreter/loop_.rs +0 -67
- package/rust/core/audio/interpreter/sleep.rs +0 -36
- package/rust/core/audio/interpreter/spawn.rs +0 -66
- package/rust/core/audio/interpreter/tempo.rs +0 -16
- package/rust/core/audio/interpreter/trigger.rs +0 -69
- package/rust/core/audio/renderer.rs +0 -54
- package/rust/core/parser/driver.rs +0 -331
- package/rust/core/preprocessor/loader.rs +0 -193
- package/rust/core/preprocessor/processor.rs +0 -76
- package/rust/core/shared/duration.rs +0 -8
- package/rust/core/shared/mod.rs +0 -2
- package/rust/core/shared/value.rs +0 -18
- package/rust/core/store/export.rs +0 -28
- package/rust/core/store/import.rs +0 -28
- package/rust/core/store/variable.rs +0 -28
- package/rust/core/utils/mod.rs +0 -2
- package/rust/core/utils/path.rs +0 -31
- package/rust/core/utils/validation.rs +0 -37
- package/rust/utils/file.rs +0 -35
- package/rust/utils/signature.rs +0 -17
- package/rust/utils/version.rs +0 -15
- package/typescript/scripts/postbuild.ts +0 -8
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
use crate::core::lexer::{
|
|
2
2
|
handler::{
|
|
3
|
-
arrow::handle_arrow_lexer,
|
|
3
|
+
arrow::handle_arrow_lexer,
|
|
4
|
+
at::handle_at_lexer,
|
|
5
|
+
brace::{handle_lbrace_lexer, handle_rbrace_lexer},
|
|
6
|
+
colon::handle_colon_lexer,
|
|
7
|
+
comment::handle_comment_lexer,
|
|
8
|
+
dot::handle_dot_lexer,
|
|
9
|
+
identifier::handle_identifier_lexer,
|
|
10
|
+
indent::handle_indent_lexer,
|
|
11
|
+
newline::handle_newline_lexer,
|
|
12
|
+
number::handle_number_lexer,
|
|
13
|
+
operator::handle_operator_lexer,
|
|
14
|
+
parenthesis::{handle_lparen_lexer, handle_rparen_lexer},
|
|
15
|
+
slash::handle_slash_lexer,
|
|
16
|
+
string::handle_string_lexer,
|
|
4
17
|
},
|
|
5
|
-
token::{
|
|
18
|
+
token::{Token, TokenKind},
|
|
6
19
|
};
|
|
7
20
|
|
|
8
21
|
fn advance_char<I: Iterator<Item = char>>(
|
|
9
22
|
chars: &mut std::iter::Peekable<I>,
|
|
10
|
-
|
|
11
|
-
column: &mut usize
|
|
23
|
+
_line: &mut usize,
|
|
24
|
+
column: &mut usize,
|
|
12
25
|
) -> Option<char> {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
for c in chars.by_ref() {
|
|
27
|
+
if c == '\r' {
|
|
28
|
+
continue;
|
|
29
|
+
} else if c == '\n' {
|
|
30
|
+
// newline: don't increment column
|
|
31
|
+
} else {
|
|
32
|
+
*column += 1;
|
|
33
|
+
}
|
|
34
|
+
return Some(c);
|
|
18
35
|
}
|
|
19
|
-
|
|
36
|
+
None
|
|
20
37
|
}
|
|
21
38
|
|
|
22
39
|
pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
@@ -39,7 +56,7 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
39
56
|
&mut indent_stack,
|
|
40
57
|
&mut tokens,
|
|
41
58
|
&mut line,
|
|
42
|
-
&mut column
|
|
59
|
+
&mut column,
|
|
43
60
|
);
|
|
44
61
|
|
|
45
62
|
at_line_start = false;
|
|
@@ -58,7 +75,7 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
58
75
|
&mut line,
|
|
59
76
|
&mut column,
|
|
60
77
|
&mut at_line_start,
|
|
61
|
-
&mut current_indent
|
|
78
|
+
&mut current_indent,
|
|
62
79
|
);
|
|
63
80
|
}
|
|
64
81
|
' ' | '\t' => {
|
|
@@ -72,7 +89,7 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
72
89
|
&mut indent_stack,
|
|
73
90
|
&mut tokens,
|
|
74
91
|
&mut line,
|
|
75
|
-
&mut column
|
|
92
|
+
&mut column,
|
|
76
93
|
);
|
|
77
94
|
}
|
|
78
95
|
':' => {
|
|
@@ -83,10 +100,10 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
83
100
|
&mut indent_stack,
|
|
84
101
|
&mut tokens,
|
|
85
102
|
&mut line,
|
|
86
|
-
&mut column
|
|
103
|
+
&mut column,
|
|
87
104
|
);
|
|
88
105
|
}
|
|
89
|
-
'=' | '!' | '<' | '>' => {
|
|
106
|
+
'=' | '!' | '<' | '>' | '+' | '*' => {
|
|
90
107
|
handle_operator_lexer(
|
|
91
108
|
ch,
|
|
92
109
|
&mut chars,
|
|
@@ -94,7 +111,18 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
94
111
|
&mut indent_stack,
|
|
95
112
|
&mut tokens,
|
|
96
113
|
&mut line,
|
|
97
|
-
&mut column
|
|
114
|
+
&mut column,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
'/' => {
|
|
118
|
+
handle_slash_lexer(
|
|
119
|
+
ch,
|
|
120
|
+
&mut chars,
|
|
121
|
+
&mut current_indent,
|
|
122
|
+
&mut indent_stack,
|
|
123
|
+
&mut tokens,
|
|
124
|
+
&mut line,
|
|
125
|
+
&mut column,
|
|
98
126
|
);
|
|
99
127
|
}
|
|
100
128
|
'-' => {
|
|
@@ -105,8 +133,22 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
105
133
|
&mut indent_stack,
|
|
106
134
|
&mut tokens,
|
|
107
135
|
&mut line,
|
|
108
|
-
&mut column
|
|
136
|
+
&mut column,
|
|
109
137
|
);
|
|
138
|
+
// If not parsed as arrow or number, fallback as Minus token
|
|
139
|
+
if let Some(last) = tokens.last() {
|
|
140
|
+
if last.kind == TokenKind::Unknown && last.lexeme == "-" {
|
|
141
|
+
// replace last with Minus
|
|
142
|
+
let _ = tokens.pop();
|
|
143
|
+
tokens.push(Token {
|
|
144
|
+
kind: TokenKind::Minus,
|
|
145
|
+
lexeme: "-".to_string(),
|
|
146
|
+
line,
|
|
147
|
+
column,
|
|
148
|
+
indent: current_indent,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
110
152
|
}
|
|
111
153
|
'{' => {
|
|
112
154
|
handle_lbrace_lexer(
|
|
@@ -116,7 +158,7 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
116
158
|
&mut indent_stack,
|
|
117
159
|
&mut tokens,
|
|
118
160
|
&mut line,
|
|
119
|
-
&mut column
|
|
161
|
+
&mut column,
|
|
120
162
|
);
|
|
121
163
|
}
|
|
122
164
|
'}' => {
|
|
@@ -127,7 +169,56 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
127
169
|
&mut indent_stack,
|
|
128
170
|
&mut tokens,
|
|
129
171
|
&mut line,
|
|
130
|
-
&mut column
|
|
172
|
+
&mut column,
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
'[' => {
|
|
176
|
+
tokens.push(Token {
|
|
177
|
+
kind: TokenKind::LBracket,
|
|
178
|
+
lexeme: "[".to_string(),
|
|
179
|
+
line,
|
|
180
|
+
column,
|
|
181
|
+
indent: current_indent,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
']' => {
|
|
185
|
+
tokens.push(Token {
|
|
186
|
+
kind: TokenKind::RBracket,
|
|
187
|
+
lexeme: "]".to_string(),
|
|
188
|
+
line,
|
|
189
|
+
column,
|
|
190
|
+
indent: current_indent,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
',' => {
|
|
194
|
+
tokens.push(Token {
|
|
195
|
+
kind: TokenKind::Comma,
|
|
196
|
+
lexeme: ",".to_string(),
|
|
197
|
+
line,
|
|
198
|
+
column,
|
|
199
|
+
indent: current_indent,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
'(' => {
|
|
203
|
+
handle_lparen_lexer(
|
|
204
|
+
ch,
|
|
205
|
+
&mut chars,
|
|
206
|
+
&mut current_indent,
|
|
207
|
+
&mut indent_stack,
|
|
208
|
+
&mut tokens,
|
|
209
|
+
&mut line,
|
|
210
|
+
&mut column,
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
')' => {
|
|
214
|
+
handle_rparen_lexer(
|
|
215
|
+
ch,
|
|
216
|
+
&mut chars,
|
|
217
|
+
&mut current_indent,
|
|
218
|
+
&mut indent_stack,
|
|
219
|
+
&mut tokens,
|
|
220
|
+
&mut line,
|
|
221
|
+
&mut column,
|
|
131
222
|
);
|
|
132
223
|
}
|
|
133
224
|
'.' => {
|
|
@@ -138,7 +229,7 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
138
229
|
&mut indent_stack,
|
|
139
230
|
&mut tokens,
|
|
140
231
|
&mut line,
|
|
141
|
-
&mut column
|
|
232
|
+
&mut column,
|
|
142
233
|
);
|
|
143
234
|
}
|
|
144
235
|
'@' => {
|
|
@@ -149,40 +240,60 @@ pub fn handle_content_lexing(content: String) -> Result<Vec<Token>, String> {
|
|
|
149
240
|
&mut indent_stack,
|
|
150
241
|
&mut tokens,
|
|
151
242
|
&mut line,
|
|
152
|
-
&mut column
|
|
243
|
+
&mut column,
|
|
153
244
|
);
|
|
154
245
|
}
|
|
155
|
-
'
|
|
156
|
-
|
|
246
|
+
'$' => {
|
|
247
|
+
// Treat `$` as start of a special identifier like `$env` or `$math`
|
|
248
|
+
let mut ident = String::from("$");
|
|
249
|
+
while let Some(&c) = chars.peek() {
|
|
250
|
+
if c.is_ascii_alphanumeric() || c == '_' {
|
|
251
|
+
ident.push(c);
|
|
252
|
+
chars.next();
|
|
253
|
+
column += 1;
|
|
254
|
+
} else {
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
tokens.push(Token {
|
|
259
|
+
kind: TokenKind::Identifier,
|
|
260
|
+
lexeme: ident,
|
|
261
|
+
line,
|
|
262
|
+
column,
|
|
263
|
+
indent: current_indent,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
'0'..='9' => {
|
|
267
|
+
handle_number_lexer(
|
|
157
268
|
ch,
|
|
158
269
|
&mut chars,
|
|
159
270
|
&mut current_indent,
|
|
160
271
|
&mut indent_stack,
|
|
161
272
|
&mut tokens,
|
|
162
273
|
&mut line,
|
|
163
|
-
&mut column
|
|
274
|
+
&mut column,
|
|
164
275
|
);
|
|
165
276
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
277
|
+
'a'..='z' | 'A'..='Z' | '_' => {
|
|
278
|
+
handle_identifier_lexer(
|
|
279
|
+
ch,
|
|
169
280
|
&mut chars,
|
|
170
281
|
&mut current_indent,
|
|
171
282
|
&mut indent_stack,
|
|
172
283
|
&mut tokens,
|
|
173
284
|
&mut line,
|
|
174
|
-
&mut column
|
|
285
|
+
&mut column,
|
|
175
286
|
);
|
|
176
287
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
288
|
+
'"' | '\'' => {
|
|
289
|
+
handle_string_lexer(
|
|
290
|
+
ch,
|
|
180
291
|
&mut chars,
|
|
181
292
|
&mut current_indent,
|
|
182
293
|
&mut indent_stack,
|
|
183
294
|
&mut tokens,
|
|
184
295
|
&mut line,
|
|
185
|
-
&mut column
|
|
296
|
+
&mut column,
|
|
186
297
|
);
|
|
187
298
|
}
|
|
188
299
|
_ => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_identifier_lexer(
|
|
4
|
-
|
|
4
|
+
ch: char,
|
|
5
5
|
chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
6
|
current_indent: &mut usize,
|
|
7
|
-
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
8
|
tokens: &mut Vec<Token>,
|
|
9
9
|
line: &mut usize,
|
|
10
|
-
column: &mut usize
|
|
10
|
+
column: &mut usize,
|
|
11
11
|
) {
|
|
12
|
-
let mut ident =
|
|
12
|
+
let mut ident = ch.to_string();
|
|
13
13
|
|
|
14
14
|
while let Some(&c) = chars.peek() {
|
|
15
15
|
if c.is_ascii_alphanumeric() || c == '_' {
|
|
@@ -25,9 +25,15 @@ pub fn handle_identifier_lexer(
|
|
|
25
25
|
"if" => TokenKind::If,
|
|
26
26
|
"else" => TokenKind::Else,
|
|
27
27
|
"bank" => TokenKind::Bank,
|
|
28
|
+
"pattern" => TokenKind::Pattern,
|
|
28
29
|
"bpm" => TokenKind::Tempo,
|
|
29
30
|
"loop" => TokenKind::Loop,
|
|
31
|
+
"for" => TokenKind::Loop,
|
|
30
32
|
"synth" => TokenKind::Synth,
|
|
33
|
+
"fn" => TokenKind::Function,
|
|
34
|
+
"as" => TokenKind::As,
|
|
35
|
+
"on" => TokenKind::On,
|
|
36
|
+
"emit" => TokenKind::Emit,
|
|
31
37
|
_ => TokenKind::Identifier,
|
|
32
38
|
};
|
|
33
39
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_indent_lexer(
|
|
4
4
|
chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
@@ -6,7 +6,7 @@ pub fn handle_indent_lexer(
|
|
|
6
6
|
indent_stack: &mut Vec<usize>,
|
|
7
7
|
tokens: &mut Vec<Token>,
|
|
8
8
|
line: &mut usize,
|
|
9
|
-
column: &mut usize
|
|
9
|
+
column: &mut usize,
|
|
10
10
|
) {
|
|
11
11
|
*current_indent = 0;
|
|
12
12
|
let mut col = *column;
|
|
@@ -16,10 +16,24 @@ pub fn handle_indent_lexer(
|
|
|
16
16
|
*current_indent += 1;
|
|
17
17
|
chars.next();
|
|
18
18
|
col += 1;
|
|
19
|
+
tokens.push(Token {
|
|
20
|
+
kind: TokenKind::Whitespace,
|
|
21
|
+
lexeme: " ".to_string(),
|
|
22
|
+
line: *line,
|
|
23
|
+
column: col,
|
|
24
|
+
indent: *current_indent,
|
|
25
|
+
});
|
|
19
26
|
} else if c == '\t' {
|
|
20
27
|
*current_indent += 4;
|
|
21
28
|
chars.next();
|
|
22
29
|
col += 4;
|
|
30
|
+
tokens.push(Token {
|
|
31
|
+
kind: TokenKind::Whitespace,
|
|
32
|
+
lexeme: "\t".to_string(),
|
|
33
|
+
line: *line,
|
|
34
|
+
column: col,
|
|
35
|
+
indent: *current_indent,
|
|
36
|
+
});
|
|
23
37
|
} else {
|
|
24
38
|
break;
|
|
25
39
|
}
|
|
@@ -32,7 +46,7 @@ pub fn handle_indent_lexer(
|
|
|
32
46
|
indent_stack.push(*current_indent);
|
|
33
47
|
tokens.push(Token {
|
|
34
48
|
kind: TokenKind::Indent,
|
|
35
|
-
lexeme: String::
|
|
49
|
+
lexeme: String::from("<INDENT>"),
|
|
36
50
|
line: *line,
|
|
37
51
|
column: *column,
|
|
38
52
|
indent: *current_indent,
|
|
@@ -42,7 +56,7 @@ pub fn handle_indent_lexer(
|
|
|
42
56
|
indent_stack.pop();
|
|
43
57
|
tokens.push(Token {
|
|
44
58
|
kind: TokenKind::Dedent,
|
|
45
|
-
lexeme: String::
|
|
59
|
+
lexeme: String::from("<DEDENT>"),
|
|
46
60
|
line: *line,
|
|
47
61
|
column: *column,
|
|
48
62
|
indent: *current_indent,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
pub mod
|
|
2
|
-
|
|
1
|
+
pub mod arrow;
|
|
3
2
|
pub mod at;
|
|
4
3
|
pub mod brace;
|
|
5
4
|
pub mod colon;
|
|
6
5
|
pub mod comment;
|
|
7
6
|
pub mod dot;
|
|
8
|
-
pub mod
|
|
7
|
+
pub mod driver;
|
|
9
8
|
pub mod identifier;
|
|
9
|
+
pub mod indent;
|
|
10
10
|
pub mod newline;
|
|
11
11
|
pub mod number;
|
|
12
|
-
pub mod
|
|
12
|
+
pub mod operator;
|
|
13
|
+
pub mod parenthesis;
|
|
14
|
+
pub mod slash;
|
|
13
15
|
pub mod string;
|
|
14
|
-
pub mod arrow;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_newline_lexer(
|
|
4
4
|
ch: char,
|
|
5
|
-
|
|
5
|
+
_chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
6
|
tokens: &mut Vec<Token>,
|
|
7
7
|
line: &mut usize,
|
|
8
8
|
column: &mut usize,
|
|
9
9
|
at_line_start: &mut bool,
|
|
10
|
-
current_indent: &mut usize
|
|
10
|
+
current_indent: &mut usize,
|
|
11
11
|
) {
|
|
12
12
|
tokens.push(Token {
|
|
13
13
|
kind: TokenKind::Newline,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_number_lexer(
|
|
4
|
-
|
|
4
|
+
ch: char,
|
|
5
5
|
chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
6
|
current_indent: &mut usize,
|
|
7
|
-
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
8
|
tokens: &mut Vec<Token>,
|
|
9
9
|
line: &mut usize,
|
|
10
|
-
column: &mut usize
|
|
10
|
+
column: &mut usize,
|
|
11
11
|
) {
|
|
12
|
-
let mut number =
|
|
12
|
+
let mut number = ch.to_string();
|
|
13
13
|
|
|
14
14
|
while let Some(&c) = chars.peek() {
|
|
15
15
|
if c.is_ascii_digit() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_operator_lexer(
|
|
4
4
|
ch: char,
|
|
5
5
|
chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
6
|
current_indent: &mut usize,
|
|
7
|
-
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
8
|
tokens: &mut Vec<Token>,
|
|
9
9
|
line: &mut usize,
|
|
10
|
-
column: &mut usize
|
|
10
|
+
column: &mut usize,
|
|
11
11
|
) {
|
|
12
12
|
let next = chars.peek().copied();
|
|
13
13
|
|
|
@@ -16,6 +16,8 @@ pub fn handle_operator_lexer(
|
|
|
16
16
|
('!', Some('=')) => (TokenKind::NotEquals, 2),
|
|
17
17
|
('>', Some('=')) => (TokenKind::GreaterEqual, 2),
|
|
18
18
|
('<', Some('=')) => (TokenKind::LessEqual, 2),
|
|
19
|
+
('+', _) => (TokenKind::Plus, 1),
|
|
20
|
+
('*', _) => (TokenKind::Asterisk, 1),
|
|
19
21
|
('=', _) => (TokenKind::Equals, 1),
|
|
20
22
|
('>', _) => (TokenKind::Greater, 1),
|
|
21
23
|
('<', _) => (TokenKind::Less, 1),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
|
+
|
|
3
|
+
pub fn handle_rparen_lexer(
|
|
4
|
+
ch: char,
|
|
5
|
+
_chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
|
+
current_indent: &mut usize,
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
|
+
tokens: &mut Vec<Token>,
|
|
9
|
+
line: &mut usize,
|
|
10
|
+
column: &mut usize,
|
|
11
|
+
) {
|
|
12
|
+
tokens.push(Token {
|
|
13
|
+
kind: TokenKind::RParen,
|
|
14
|
+
lexeme: ch.to_string(),
|
|
15
|
+
line: *line,
|
|
16
|
+
column: *column,
|
|
17
|
+
indent: *current_indent,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
*column += 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
pub fn handle_lparen_lexer(
|
|
24
|
+
ch: char,
|
|
25
|
+
_chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
26
|
+
current_indent: &mut usize,
|
|
27
|
+
_indent_stack: &mut [usize],
|
|
28
|
+
tokens: &mut Vec<Token>,
|
|
29
|
+
line: &mut usize,
|
|
30
|
+
column: &mut usize,
|
|
31
|
+
) {
|
|
32
|
+
tokens.push(Token {
|
|
33
|
+
kind: TokenKind::LParen,
|
|
34
|
+
lexeme: ch.to_string(),
|
|
35
|
+
line: *line,
|
|
36
|
+
column: *column,
|
|
37
|
+
indent: *current_indent,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
*column += 1;
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
|
+
|
|
3
|
+
pub fn handle_slash_lexer(
|
|
4
|
+
ch: char,
|
|
5
|
+
_chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
|
+
current_indent: &mut usize,
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
|
+
tokens: &mut Vec<Token>,
|
|
9
|
+
line: &mut usize,
|
|
10
|
+
column: &mut usize,
|
|
11
|
+
) {
|
|
12
|
+
let slash = ch.to_string();
|
|
13
|
+
|
|
14
|
+
tokens.push(Token {
|
|
15
|
+
kind: TokenKind::Slash,
|
|
16
|
+
lexeme: slash,
|
|
17
|
+
line: *line,
|
|
18
|
+
column: *column,
|
|
19
|
+
indent: *current_indent,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
use crate::core::lexer::token::{
|
|
1
|
+
use crate::core::lexer::token::{Token, TokenKind};
|
|
2
2
|
|
|
3
3
|
pub fn handle_string_lexer(
|
|
4
4
|
ch: char,
|
|
5
5
|
chars: &mut std::iter::Peekable<std::str::Chars>,
|
|
6
6
|
current_indent: &mut usize,
|
|
7
|
-
|
|
7
|
+
_indent_stack: &mut [usize],
|
|
8
8
|
tokens: &mut Vec<Token>,
|
|
9
9
|
line: &mut usize,
|
|
10
|
-
column: &mut usize
|
|
10
|
+
column: &mut usize,
|
|
11
11
|
) {
|
|
12
12
|
let quote_char = ch;
|
|
13
13
|
|
package/rust/core/lexer/mod.rs
CHANGED
|
@@ -1,51 +1,3 @@
|
|
|
1
|
+
pub mod driver;
|
|
1
2
|
pub mod handler;
|
|
2
3
|
pub mod token;
|
|
3
|
-
|
|
4
|
-
use std::fs;
|
|
5
|
-
use std::path::{Path, PathBuf};
|
|
6
|
-
use crate::core::{
|
|
7
|
-
lexer::{ handler::driver::handle_content_lexing, token::Token },
|
|
8
|
-
utils::path::normalize_path,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
pub struct Lexer {}
|
|
12
|
-
|
|
13
|
-
impl Lexer {
|
|
14
|
-
pub fn new() -> Self {
|
|
15
|
-
Lexer {}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
pub fn lex_from_source(&self, source: &str) -> Result<Vec<Token>, String> {
|
|
19
|
-
handle_content_lexing(source.to_string())
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
pub fn lex_tokens(&self, entrypoint: &str) -> Vec<Token> {
|
|
23
|
-
let path = normalize_path(entrypoint);
|
|
24
|
-
let resolved_path = Self::resolve_entry_path(&path);
|
|
25
|
-
|
|
26
|
-
let file_content =
|
|
27
|
-
fs::read_to_string(&resolved_path).expect("Failed to read the entrypoint file");
|
|
28
|
-
|
|
29
|
-
handle_content_lexing(file_content).expect("Failed to lex the content")
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fn resolve_entry_path(path: &str) -> String {
|
|
33
|
-
let candidate = Path::new(path);
|
|
34
|
-
|
|
35
|
-
if candidate.is_dir() {
|
|
36
|
-
let index_path = candidate.join("index.deva");
|
|
37
|
-
if index_path.exists() {
|
|
38
|
-
return index_path.to_string_lossy().replace("\\", "/");
|
|
39
|
-
} else {
|
|
40
|
-
panic!(
|
|
41
|
-
"Expected 'index.deva' in directory '{}', but it was not found",
|
|
42
|
-
path
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
} else if candidate.is_file() {
|
|
46
|
-
return path.to_string();
|
|
47
|
-
} else {
|
|
48
|
-
panic!("Provided entrypoint '{}' is not a valid file or directory", path);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
package/rust/core/lexer/token.rs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
use serde::{
|
|
1
|
+
use serde::{Deserialize, Serialize};
|
|
2
2
|
|
|
3
3
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
4
4
|
pub struct Token {
|
|
@@ -11,14 +11,7 @@ pub struct Token {
|
|
|
11
11
|
|
|
12
12
|
impl Token {
|
|
13
13
|
pub fn is_error(&self) -> bool {
|
|
14
|
-
|
|
15
|
-
TokenKind::Error(_) => {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
_ => {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
};
|
|
14
|
+
matches!(&self.kind, TokenKind::Error(_))
|
|
22
15
|
}
|
|
23
16
|
}
|
|
24
17
|
|
|
@@ -28,7 +21,12 @@ pub enum TokenKind {
|
|
|
28
21
|
At,
|
|
29
22
|
Tempo,
|
|
30
23
|
Bank,
|
|
24
|
+
Pattern,
|
|
31
25
|
Loop,
|
|
26
|
+
Function,
|
|
27
|
+
As,
|
|
28
|
+
On,
|
|
29
|
+
Emit,
|
|
32
30
|
|
|
33
31
|
// ───── Instruments ─────
|
|
34
32
|
Synth,
|
|
@@ -49,6 +47,10 @@ pub enum TokenKind {
|
|
|
49
47
|
Comma,
|
|
50
48
|
Equals,
|
|
51
49
|
Dot,
|
|
50
|
+
Slash,
|
|
51
|
+
Plus,
|
|
52
|
+
Asterisk,
|
|
53
|
+
Minus,
|
|
52
54
|
|
|
53
55
|
// ───── Operators ─────
|
|
54
56
|
DoubleEquals,
|
|
@@ -59,13 +61,15 @@ pub enum TokenKind {
|
|
|
59
61
|
Less,
|
|
60
62
|
|
|
61
63
|
// ───── Brackets ─────
|
|
62
|
-
LBrace,
|
|
63
|
-
RBrace,
|
|
64
|
+
LBrace, // {
|
|
65
|
+
RBrace, // }
|
|
64
66
|
LBracket, // [
|
|
65
67
|
RBracket, // ]
|
|
68
|
+
LParen, // (
|
|
69
|
+
RParen, // )
|
|
66
70
|
|
|
67
71
|
// ───── Quotes ─────
|
|
68
|
-
Quote,
|
|
72
|
+
Quote, // '
|
|
69
73
|
DbQuote, // "
|
|
70
74
|
|
|
71
75
|
// ───── Formatting ─────
|
|
@@ -80,6 +84,7 @@ pub enum TokenKind {
|
|
|
80
84
|
ElseIf,
|
|
81
85
|
|
|
82
86
|
// ───── Special / Internal ─────
|
|
87
|
+
Whitespace,
|
|
83
88
|
Unknown,
|
|
84
89
|
Error(String),
|
|
85
90
|
EOF,
|
package/rust/core/mod.rs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
pub mod
|
|
2
|
-
pub mod
|
|
3
|
-
pub mod
|
|
4
|
-
pub mod
|
|
5
|
-
pub mod
|
|
6
|
-
pub mod
|
|
7
|
-
pub mod
|
|
8
|
-
pub mod
|
|
9
|
-
pub mod
|
|
10
|
-
pub mod audio;
|
|
1
|
+
pub mod audio;
|
|
2
|
+
pub mod builder;
|
|
3
|
+
pub mod debugger;
|
|
4
|
+
pub mod error;
|
|
5
|
+
pub mod lexer;
|
|
6
|
+
pub mod parser;
|
|
7
|
+
pub mod plugin;
|
|
8
|
+
pub mod preprocessor;
|
|
9
|
+
pub mod store;
|