@devaloop/devalang 0.0.1-alpha.11 → 0.0.1-alpha.13
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/.devalang +8 -8
- package/Cargo.toml +8 -8
- package/README.md +1 -14
- package/docs/CHANGELOG.md +44 -0
- package/docs/TODO.md +1 -1
- package/examples/index.deva +10 -11
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +2 -1
- package/project-version.json +3 -3
- package/rust/cli/build.rs +25 -2
- package/rust/cli/check.rs +26 -3
- package/rust/cli/play.rs +1 -1
- package/rust/core/audio/engine.rs +207 -41
- package/rust/core/audio/interpreter/call.rs +72 -47
- package/rust/core/audio/interpreter/condition.rs +14 -12
- package/rust/core/audio/interpreter/driver.rs +84 -127
- package/rust/core/audio/interpreter/function.rs +21 -0
- package/rust/core/audio/interpreter/load.rs +1 -1
- package/rust/core/audio/interpreter/loop_.rs +24 -18
- package/rust/core/audio/interpreter/mod.rs +2 -1
- package/rust/core/audio/interpreter/sleep.rs +0 -6
- package/rust/core/audio/interpreter/spawn.rs +78 -60
- package/rust/core/audio/interpreter/trigger.rs +169 -61
- package/rust/core/audio/loader/trigger.rs +37 -4
- package/rust/core/audio/player.rs +20 -10
- package/rust/core/audio/renderer.rs +24 -25
- package/rust/core/debugger/mod.rs +2 -0
- package/rust/core/debugger/module.rs +47 -0
- package/rust/core/debugger/store.rs +25 -11
- package/rust/core/error/mod.rs +6 -0
- package/rust/core/lexer/handler/driver.rs +23 -1
- package/rust/core/lexer/handler/identifier.rs +1 -0
- package/rust/core/lexer/handler/mod.rs +1 -0
- package/rust/core/lexer/handler/parenthesis.rs +41 -0
- package/rust/core/lexer/token.rs +3 -0
- package/rust/core/parser/driver.rs +31 -3
- package/rust/core/parser/handler/dot.rs +65 -129
- package/rust/core/parser/handler/identifier/call.rs +69 -22
- package/rust/core/parser/handler/identifier/function.rs +92 -0
- package/rust/core/parser/handler/identifier/let_.rs +13 -19
- package/rust/core/parser/handler/identifier/mod.rs +1 -0
- package/rust/core/parser/handler/identifier/spawn.rs +74 -27
- package/rust/core/parser/statement.rs +16 -4
- package/rust/core/preprocessor/loader.rs +45 -29
- package/rust/core/preprocessor/module.rs +3 -1
- package/rust/core/preprocessor/processor.rs +26 -1
- package/rust/core/preprocessor/resolver/call.rs +61 -84
- package/rust/core/preprocessor/resolver/condition.rs +11 -6
- package/rust/core/preprocessor/resolver/driver.rs +52 -6
- package/rust/core/preprocessor/resolver/function.rs +78 -0
- package/rust/core/preprocessor/resolver/group.rs +43 -13
- package/rust/core/preprocessor/resolver/let_.rs +7 -10
- package/rust/core/preprocessor/resolver/mod.rs +2 -1
- package/rust/core/preprocessor/resolver/spawn.rs +64 -30
- package/rust/core/preprocessor/resolver/trigger.rs +7 -3
- package/rust/core/preprocessor/resolver/value.rs +10 -1
- package/rust/core/shared/value.rs +4 -1
- package/rust/core/store/function.rs +34 -0
- package/rust/core/store/global.rs +9 -10
- package/rust/core/store/mod.rs +2 -1
- package/rust/core/store/variable.rs +6 -0
- package/rust/installer/bank.rs +1 -1
- package/rust/installer/mod.rs +2 -1
- package/rust/lib.rs +10 -8
- package/rust/utils/mod.rs +44 -1
- /package/rust/{utils/installer.rs → installer/utils.rs} +0 -0
package/rust/utils/mod.rs
CHANGED
|
@@ -4,4 +4,47 @@ pub mod spinner;
|
|
|
4
4
|
pub mod watcher;
|
|
5
5
|
pub mod file;
|
|
6
6
|
pub mod logger;
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
use crate::core::parser::statement::{Statement, StatementKind};
|
|
9
|
+
use crate::core::error::ErrorResult;
|
|
10
|
+
use crate::core::shared::value::Value;
|
|
11
|
+
|
|
12
|
+
pub fn collect_errors_recursively(statements: &[Statement]) -> Vec<ErrorResult> {
|
|
13
|
+
let mut errors: Vec<ErrorResult> = Vec::new();
|
|
14
|
+
|
|
15
|
+
for stmt in statements {
|
|
16
|
+
match &stmt.kind {
|
|
17
|
+
StatementKind::Unknown => {
|
|
18
|
+
errors.push(ErrorResult {
|
|
19
|
+
message: format!("Unknown statement at line {}:{}", stmt.line, stmt.column),
|
|
20
|
+
line: stmt.line,
|
|
21
|
+
column: stmt.column,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
StatementKind::Error { message } => {
|
|
25
|
+
errors.push(ErrorResult {
|
|
26
|
+
message: message.clone(),
|
|
27
|
+
line: stmt.line,
|
|
28
|
+
column: stmt.column,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
StatementKind::Loop => {
|
|
32
|
+
if let Some(body_statements) = extract_loop_body_statements(&stmt.value) {
|
|
33
|
+
errors.extend(collect_errors_recursively(body_statements));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_ => {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
errors
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub fn extract_loop_body_statements(value: &Value) -> Option<&[Statement]> {
|
|
44
|
+
if let Value::Map(map) = value {
|
|
45
|
+
if let Some(Value::Block(statements)) = map.get("body") {
|
|
46
|
+
return Some(statements);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
None
|
|
50
|
+
}
|
|
File without changes
|