@devaloop/devalang 0.0.1-alpha.2 → 0.0.1-alpha.3

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.
Files changed (96) hide show
  1. package/Cargo.toml +46 -46
  2. package/README.md +7 -6
  3. package/docs/CHANGELOG.md +11 -6
  4. package/docs/ROADMAP.md +5 -1
  5. package/docs/TODO.md +6 -31
  6. package/examples/exported.deva +1 -1
  7. package/examples/index.deva +1 -0
  8. package/out-tsc/bin/devalang.exe +0 -0
  9. package/package.json +1 -2
  10. package/project-version.json +3 -3
  11. package/rust/cli/build.rs +57 -40
  12. package/rust/cli/check.rs +47 -111
  13. package/rust/cli/init.rs +1 -1
  14. package/rust/cli/mod.rs +174 -2
  15. package/rust/{utils/config.rs → config/loader.rs} +3 -2
  16. package/rust/{core/types/config.rs → config/mod.rs} +5 -5
  17. package/rust/core/builder/mod.rs +21 -27
  18. package/rust/core/debugger/lexer.rs +12 -0
  19. package/rust/core/debugger/mod.rs +12 -49
  20. package/rust/core/debugger/preprocessor.rs +23 -0
  21. package/rust/core/error/mod.rs +60 -0
  22. package/rust/core/lexer/{at.rs → handler/at.rs} +1 -1
  23. package/rust/core/lexer/{brace.rs → handler/brace.rs} +1 -1
  24. package/rust/core/lexer/{colon.rs → handler/colon.rs} +1 -1
  25. package/rust/core/lexer/{comment.rs → handler/comment.rs} +3 -3
  26. package/rust/core/lexer/{dot.rs → handler/dot.rs} +1 -1
  27. package/rust/core/lexer/{equal.rs → handler/equal.rs} +1 -1
  28. package/rust/core/lexer/{identifier.rs → handler/identifier.rs} +1 -1
  29. package/rust/core/lexer/{indent.rs → handler/indent.rs} +10 -5
  30. package/rust/core/lexer/handler/mod.rs +238 -0
  31. package/rust/core/lexer/{newline.rs → handler/newline.rs} +6 -10
  32. package/rust/core/lexer/{number.rs → handler/number.rs} +1 -1
  33. package/rust/core/lexer/handler/string.rs +66 -0
  34. package/rust/core/lexer/mod.rs +25 -14
  35. package/rust/core/lexer/token.rs +55 -0
  36. package/rust/core/mod.rs +5 -2
  37. package/rust/core/parser/handler/at.rs +166 -0
  38. package/rust/core/parser/handler/bank.rs +38 -0
  39. package/rust/core/parser/handler/dot.rs +112 -0
  40. package/rust/core/parser/handler/identifier.rs +134 -0
  41. package/rust/core/parser/handler/loop_.rs +55 -0
  42. package/rust/core/parser/handler/mod.rs +6 -0
  43. package/rust/core/parser/handler/tempo.rs +47 -0
  44. package/rust/core/parser/mod.rs +204 -166
  45. package/rust/core/parser/statement.rs +91 -0
  46. package/rust/core/preprocessor/loader.rs +105 -0
  47. package/rust/core/preprocessor/mod.rs +2 -24
  48. package/rust/core/preprocessor/module.rs +37 -56
  49. package/rust/core/preprocessor/processor.rs +41 -0
  50. package/rust/core/preprocessor/resolver.rs +372 -0
  51. package/rust/core/shared/duration.rs +8 -0
  52. package/rust/core/shared/mod.rs +2 -0
  53. package/rust/core/shared/value.rs +18 -0
  54. package/rust/core/store/export.rs +28 -0
  55. package/rust/core/store/global.rs +39 -0
  56. package/rust/core/store/import.rs +28 -0
  57. package/rust/core/store/mod.rs +4 -0
  58. package/rust/core/store/variable.rs +28 -0
  59. package/rust/core/utils/mod.rs +2 -0
  60. package/rust/core/utils/validation.rs +35 -0
  61. package/rust/lib.rs +0 -1
  62. package/rust/main.rs +17 -19
  63. package/rust/utils/logger.rs +69 -34
  64. package/rust/utils/mod.rs +3 -5
  65. package/templates/minimal/.devalang +1 -1
  66. package/templates/welcome/.devalang +1 -1
  67. package/rust/audio/mod.rs +0 -1
  68. package/rust/core/lexer/bracket.rs +0 -41
  69. package/rust/core/lexer/driver.rs +0 -286
  70. package/rust/core/lexer/quote.rs +0 -61
  71. package/rust/core/parser/at.rs +0 -142
  72. package/rust/core/parser/bank.rs +0 -42
  73. package/rust/core/parser/dot.rs +0 -137
  74. package/rust/core/parser/identifer.rs +0 -91
  75. package/rust/core/parser/loop_.rs +0 -62
  76. package/rust/core/parser/tempo.rs +0 -42
  77. package/rust/core/parser/variable.rs +0 -129
  78. package/rust/core/preprocessor/dependencies.rs +0 -54
  79. package/rust/core/preprocessor/resolver/at.rs +0 -24
  80. package/rust/core/preprocessor/resolver/bank.rs +0 -59
  81. package/rust/core/preprocessor/resolver/loop_.rs +0 -82
  82. package/rust/core/preprocessor/resolver/mod.rs +0 -113
  83. package/rust/core/preprocessor/resolver/tempo.rs +0 -70
  84. package/rust/core/preprocessor/resolver/trigger.rs +0 -176
  85. package/rust/core/types/cli.rs +0 -182
  86. package/rust/core/types/mod.rs +0 -8
  87. package/rust/core/types/module.rs +0 -41
  88. package/rust/core/types/parser.rs +0 -73
  89. package/rust/core/types/statement.rs +0 -105
  90. package/rust/core/types/store.rs +0 -116
  91. package/rust/core/types/token.rs +0 -83
  92. package/rust/core/types/variable.rs +0 -32
  93. package/rust/runner/executer.rs +0 -44
  94. package/rust/runner/mod.rs +0 -1
  95. /package/rust/{utils → core/utils}/path.rs +0 -0
  96. /package/rust/utils/{loader.rs → spinner.rs} +0 -0
@@ -1,182 +0,0 @@
1
- use clap::{ Parser, Subcommand };
2
- use crate::utils::version::get_version;
3
-
4
- #[derive(Parser)]
5
- #[command(name = "devalang")]
6
- #[command(author = "Devaloop")]
7
- #[command(version = get_version())]
8
- #[command(about = "🦊 Devalang – A programming language for music and sound.")]
9
- pub struct Cli {
10
- #[arg(long, global = true)]
11
- /// Skips loading the configuration file.
12
- pub no_config: bool,
13
-
14
- #[command(subcommand)]
15
- pub command: CliCommands,
16
- }
17
-
18
- #[derive(Subcommand)]
19
- pub enum CliTemplateCommand {
20
- /// Lists all available templates for Devalang projects.
21
- List,
22
- /// Displays information about a specific template.
23
- Info {
24
- name: String,
25
- },
26
- }
27
-
28
- pub enum CompilationMode {
29
- /// Real-time compilation mode, for compiling files as soon as possible.
30
- RealTime,
31
-
32
- /// Batch compilation mode, for compiling files one by one.
33
- Batch,
34
-
35
- /// Check mode, used for analyzing the code without compiling it.
36
- Check,
37
- }
38
-
39
- #[derive(Subcommand)]
40
- pub enum CliCommands {
41
- /// Create a new Devalang project.
42
- ///
43
- /// ### Arguments
44
- /// - `name` - The name of the project to create.
45
- /// - `template` - The template to use for the project. Defaults to "default".
46
- ///
47
- /// ### Example
48
- /// ```bash
49
- /// devalang init --name my_project --template default
50
- ///
51
- Init {
52
- #[arg(short, long)]
53
- /// The optional name (directory) of the project to create.
54
- name: Option<String>,
55
-
56
- #[arg(short, long)]
57
- /// The template to use for the project.
58
- ///
59
- /// ### Default value
60
- /// - `default`
61
- ///
62
- template: Option<String>,
63
- },
64
-
65
- Template {
66
- #[command(subcommand)]
67
- /// The template command to execute.
68
- command: CliTemplateCommand,
69
- },
70
-
71
- /// Build the program and generate output files.
72
- ///
73
- /// ### Arguments
74
- /// - `entry` - The entry point of the program to build. Defaults to "./src".
75
- /// - `output` - The directory where the output files will be generated. Defaults to "./output".
76
- /// - `watch` - Whether to watch for changes and rebuild. Defaults to "true".
77
- ///
78
- /// ### Example
79
- /// ```bash
80
- /// devalang build --entry ./src --output ./output --watch true
81
- /// ```
82
- ///
83
- Build {
84
- #[arg(short, long)]
85
- /// The entry point of the program to build.
86
- ///
87
- entry: Option<String>,
88
-
89
- #[arg(short, long)]
90
- /// The directory where the output files will be generated.
91
- ///
92
- output: Option<String>,
93
-
94
- #[arg(long, default_value_t = false)]
95
- /// Whether to watch for changes and rebuild.
96
- ///
97
- /// ### Default value
98
- /// - `false`
99
- ///
100
- watch: bool,
101
-
102
- #[arg(long, default_value = "real-time")]
103
- /// The mode of compilation.
104
- ///
105
- /// ### Default value
106
- /// - `real-time`
107
- ///
108
- /// ### Possible values
109
- /// - `real-time` - Compiles files as soon as possible.
110
- /// - `batch` - Compiles files one by one.
111
- /// - `check` - Analyzes the code without compiling it.
112
- ///
113
- compilation_mode: String,
114
-
115
- #[arg(short, long, default_value_t = false)]
116
- /// Whether to print debug information.
117
- ///
118
- /// ### Default value
119
- /// - `false`
120
- ///
121
- debug: bool,
122
-
123
- #[arg(short, long, default_value_t = false)]
124
- /// Whether to compress the output files.
125
- ///
126
- /// ### Default value
127
- /// - `false`
128
- ///
129
- compress: bool,
130
- },
131
-
132
- /// Analyze the program for errors and warnings.
133
- ///
134
- /// ### Arguments
135
- /// - `entry` - The entry point of the program to analyze. Defaults to "./src".
136
- /// - `watch` - Whether to watch for changes and re-analyze. Defaults to "true".
137
- ///
138
- /// ### Example
139
- /// ```bash
140
- /// devalang check --entry ./src --watch true --compilation-mode real-time
141
- /// ```
142
- Check {
143
- #[arg(short, long)]
144
- /// The entry point of the program to analyze.
145
- ///
146
- entry: Option<String>,
147
-
148
- #[arg(short, long)]
149
- /// The directory where the output files will be generated.
150
- ///
151
- output: Option<String>,
152
-
153
- #[arg(long, default_value_t = false)]
154
- /// Whether to watch for changes and re-analyze.
155
- ///
156
- /// ### Default value
157
- /// - `false`
158
- ///
159
- watch: bool,
160
-
161
- #[arg(short, long, default_value = "real-time")]
162
- /// The mode of compilation.
163
- ///
164
- /// ### Default value
165
- /// - `real-time`
166
- ///
167
- /// ### Possible values
168
- /// - `real-time` - Analyzes files as soon as possible.
169
- /// - `batch` - Analyzes files one by one.
170
- /// - `check` - Analyzes the code without compiling it.
171
- ///
172
- compilation_mode: String,
173
-
174
- #[arg(short, long, default_value_t = false)]
175
- /// Whether to print debug information.
176
- ///
177
- /// ### Default value
178
- /// - `false`
179
- ///
180
- debug: bool,
181
- },
182
- }
@@ -1,8 +0,0 @@
1
- pub mod token;
2
- pub mod statement;
3
- pub mod variable;
4
- pub mod store;
5
- pub mod parser;
6
- pub mod module;
7
- pub mod cli;
8
- pub mod config;
@@ -1,41 +0,0 @@
1
- use crate::core::types::{
2
- statement::Statement,
3
- store::{ ExportTable, ImportTable, VariableTable },
4
- token::Token,
5
- variable::VariableValue,
6
- };
7
-
8
- #[derive(Debug, Clone)]
9
- pub struct Module {
10
- pub path: String,
11
- pub tokens: Vec<Token>,
12
- pub statements: Vec<Statement>,
13
- pub variable_table: VariableTable,
14
- pub export_table: ExportTable,
15
- pub import_table: ImportTable,
16
- }
17
-
18
- impl Module {
19
- pub fn new(path: String) -> Self {
20
- Module {
21
- path,
22
- tokens: Vec::new(),
23
- statements: Vec::new(),
24
- variable_table: VariableTable::new(),
25
- export_table: ExportTable::new(),
26
- import_table: ImportTable::new(),
27
- }
28
- }
29
-
30
- pub fn add_statement(&mut self, statement: Statement) {
31
- self.statements.push(statement);
32
- }
33
-
34
- pub fn set_variable(&mut self, name: String, value: VariableValue) {
35
- self.variable_table.set(name, value);
36
- }
37
-
38
- pub fn get_variable(&self, name: &str) -> Option<&VariableValue> {
39
- self.variable_table.get(name)
40
- }
41
- }
@@ -1,73 +0,0 @@
1
- use crate::core::types::{
2
- store::{ ExportTable, ImportTable, VariableTable },
3
- token::{ Token, TokenKind },
4
- };
5
-
6
- #[derive(Debug, Clone)]
7
- pub struct Parser {
8
- pub tokens: Vec<Token>,
9
- pub token_index: usize,
10
- pub variable_table: VariableTable,
11
- pub export_table: ExportTable,
12
- pub import_table: ImportTable,
13
- pub current_module: String,
14
- }
15
-
16
- impl Parser {
17
- pub fn new(tokens: Vec<Token>) -> Self {
18
- Self {
19
- tokens,
20
- token_index: 0,
21
- variable_table: VariableTable::new(),
22
- export_table: ExportTable::new(),
23
- import_table: ImportTable::new(),
24
- current_module: String::new(),
25
- }
26
- }
27
-
28
- pub fn set_tokens(&mut self, tokens: Vec<Token>) {
29
- self.tokens = tokens;
30
- self.token_index = 0;
31
- }
32
-
33
- pub fn peek(&self) -> Option<&Token> {
34
- self.tokens.get(self.token_index)
35
- }
36
-
37
- pub fn next(&mut self) -> Option<&Token> {
38
- let tok = self.tokens.get(self.token_index);
39
- self.token_index += 1;
40
- tok
41
- }
42
-
43
- pub fn expect(&mut self, kind: TokenKind) -> Result<&Token, String> {
44
- let tok = self.next().ok_or("Unexpected end of input")?;
45
- if tok.kind == kind {
46
- Ok(tok)
47
- } else {
48
- Err(format!("Expected {:?}, got {:?}", kind, tok.kind))
49
- }
50
- }
51
-
52
- pub fn collect_until<F>(&mut self, condition: F) -> Vec<Token> where F: Fn(&Token) -> bool {
53
- let mut collected = Vec::new();
54
- while let Some(token) = self.peek() {
55
- if token.kind == TokenKind::Newline || token.kind == TokenKind::Indent {
56
- self.next(); // Skip newlines and indents
57
- continue;
58
- }
59
- if token.kind == TokenKind::EOF {
60
- break;
61
- }
62
- if condition(token) {
63
- break;
64
- }
65
- collected.push(self.next().unwrap().clone());
66
- }
67
- collected
68
- }
69
-
70
- pub fn is_eof(&self) -> bool {
71
- self.token_index >= self.tokens.len()
72
- }
73
- }
@@ -1,105 +0,0 @@
1
- use std::collections::HashMap;
2
- use serde::Serialize;
3
- use crate::core::types::{ token::{ Token, TokenDuration, TokenParam }, variable::VariableValue };
4
-
5
- #[derive(Debug, Clone, Serialize)]
6
- pub struct Statement {
7
- pub kind: StatementKind,
8
- pub value: VariableValue,
9
- pub indent: usize,
10
- pub line: usize,
11
- pub column: usize,
12
- }
13
-
14
- #[derive(Debug, Clone, Serialize)]
15
- pub struct StatementResolved {
16
- pub kind: StatementKind,
17
- pub value: StatementResolvedValue,
18
- pub indent: usize,
19
- pub line: usize,
20
- pub column: usize,
21
- }
22
-
23
- #[derive(Debug, Clone, Serialize)]
24
- pub enum StatementValue {
25
- Boolean(bool),
26
- Number(f32),
27
- String(String),
28
- Array(Vec<Statement>),
29
- Map(HashMap<String, VariableValue>),
30
- Unknown,
31
- }
32
-
33
- #[derive(Debug, Clone, Serialize)]
34
- pub enum StatementResolvedValue {
35
- Boolean(bool),
36
- Number(f32),
37
- String(String),
38
- Array(Vec<StatementResolved>),
39
- Map(HashMap<String, StatementResolvedValue>),
40
- Unknown,
41
- Null,
42
- }
43
-
44
- #[derive(Debug, Clone, Serialize)]
45
- pub enum StatementIterator {
46
- Identifier(String),
47
- Number(f32),
48
- Array(Vec<Statement>),
49
- Map(HashMap<String, VariableValue>),
50
- Unknown,
51
- }
52
-
53
- #[derive(Debug, Serialize, Clone)]
54
- /// Represents the kind of a statement
55
- pub enum StatementKind {
56
- // Trigger statements
57
- Trigger {
58
- entity: String,
59
- duration: TokenDuration,
60
- // params: Vec<TokenParam>,
61
- },
62
-
63
- // Variable statements
64
- Let {
65
- name: String,
66
- },
67
-
68
- // Loop statements
69
- Loop {
70
- iterator: StatementIterator,
71
- },
72
-
73
- // Conditional statements
74
- // If {
75
- // // condition: ConditionParts,
76
- // condition_state: bool,
77
- // body: Vec<Statement>,
78
- // },
79
-
80
- // Keyword statements
81
- Tempo,
82
- Bank,
83
-
84
- // At (@) statements
85
- Include(String),
86
- Export,
87
- Import {
88
- names: Vec<String>,
89
- source: String,
90
- },
91
- Load {
92
- source: String,
93
- alias: String,
94
- },
95
-
96
- // Error & Unknown statements
97
- Unknown,
98
- Error,
99
-
100
- // Empty or ignored statements
101
- Comment(String),
102
- Indent,
103
- Dedent,
104
- NewLine,
105
- }
@@ -1,116 +0,0 @@
1
- use std::collections::HashMap;
2
-
3
- use crate::core::types::{ module::Module, variable::VariableValue };
4
-
5
- #[derive(Debug, Default)]
6
- pub struct GlobalStore {
7
- pub modules: HashMap<String, Module>,
8
- }
9
-
10
- impl GlobalStore {
11
- pub fn new() -> Self {
12
- GlobalStore {
13
- modules: HashMap::new(),
14
- }
15
- }
16
-
17
- pub fn insert_module(&mut self, path: String, module: Module) {
18
- self.modules.insert(path, module);
19
- }
20
-
21
- pub fn update_module(&mut self, path: String, module: Module) {
22
- if !self.modules.contains_key(&path) {
23
- eprintln!("❌ Module {} not found in global store for update", path);
24
- return;
25
- }
26
-
27
- // Remove the existing module if it exists
28
- self.modules.remove(&path);
29
-
30
- // Insert the updated module
31
- self.modules.insert(path, module);
32
- }
33
-
34
- pub fn get_module(&self, path: &str) -> Option<&Module> {
35
- self.modules.get(path)
36
- }
37
-
38
- pub fn remove_module(&mut self, path: &str) -> Option<Module> {
39
- self.modules.remove(path)
40
- }
41
- }
42
-
43
- #[derive(Debug, Default, Clone)]
44
- pub struct VariableTable {
45
- pub variables: HashMap<String, VariableValue>,
46
- }
47
-
48
- impl VariableTable {
49
- pub fn new() -> Self {
50
- VariableTable {
51
- variables: HashMap::new(),
52
- }
53
- }
54
-
55
- pub fn set(&mut self, name: String, value: VariableValue) {
56
- self.variables.insert(name, value);
57
- }
58
-
59
- pub fn get(&self, name: &str) -> Option<&VariableValue> {
60
- self.variables.get(name)
61
- }
62
-
63
- pub fn remove(&mut self, name: &str) -> Option<VariableValue> {
64
- self.variables.remove(name)
65
- }
66
- }
67
-
68
- #[derive(Debug, Default, Clone)]
69
- pub struct ExportTable {
70
- pub exports: HashMap<String, VariableValue>,
71
- }
72
-
73
- impl ExportTable {
74
- pub fn new() -> Self {
75
- ExportTable {
76
- exports: HashMap::new(),
77
- }
78
- }
79
-
80
- pub fn add_export(&mut self, name: String, value: VariableValue) {
81
- self.exports.insert(name, value);
82
- }
83
-
84
- pub fn get_export(&self, name: &str) -> Option<&VariableValue> {
85
- self.exports.get(name)
86
- }
87
-
88
- pub fn remove_export(&mut self, name: &str) -> Option<VariableValue> {
89
- self.exports.remove(name)
90
- }
91
- }
92
-
93
- #[derive(Debug, Default, Clone)]
94
- pub struct ImportTable {
95
- pub imports: HashMap<String, VariableValue>,
96
- }
97
-
98
- impl ImportTable {
99
- pub fn new() -> Self {
100
- ImportTable {
101
- imports: HashMap::new(),
102
- }
103
- }
104
-
105
- pub fn add_import(&mut self, name: String, value: VariableValue) {
106
- self.imports.insert(name, value);
107
- }
108
-
109
- pub fn get_import(&self, name: &str) -> Option<&VariableValue> {
110
- self.imports.get(name)
111
- }
112
-
113
- pub fn remove_import(&mut self, name: &str) -> Option<VariableValue> {
114
- self.imports.remove(name)
115
- }
116
- }
@@ -1,83 +0,0 @@
1
- use std::collections::HashMap;
2
-
3
- use serde::Serialize;
4
-
5
- #[derive(Debug, Clone, PartialEq, Serialize)]
6
- pub struct Token {
7
- pub kind: TokenKind,
8
- pub lexeme: String,
9
- pub indent: usize,
10
- pub line: usize,
11
- pub column: usize,
12
- }
13
-
14
- impl Token {
15
- pub fn is_error(&self) -> bool {
16
- match &self.kind {
17
- TokenKind::Error(_) => {
18
- return true;
19
- },
20
- _ => {
21
- return false;
22
- },
23
- };
24
- }
25
- }
26
-
27
- #[derive(Debug, Clone, PartialEq, Serialize)]
28
- pub enum TokenKind {
29
- At,
30
- Tempo,
31
- Bank,
32
- Loop,
33
- Identifier,
34
- Map,
35
- Array,
36
- Number,
37
- String,
38
- Boolean,
39
- Colon,
40
- Comma,
41
- Equals,
42
- DoubleEquals,
43
- Dot,
44
- LBrace,
45
- RBrace,
46
- DbQuote,
47
- Quote,
48
- LBracket,
49
- RBracket,
50
- Newline,
51
- Indent,
52
- Dedent,
53
- Comment(String),
54
- Unknown,
55
- Error(String),
56
- EOF,
57
- }
58
-
59
- #[derive(Debug, Clone, PartialEq, Serialize)]
60
- pub enum TokenDuration {
61
- Number(f32),
62
- Identifier(String),
63
- Infinite,
64
- Auto,
65
- Unknown,
66
- }
67
-
68
- #[derive(Debug, Clone, PartialEq, Serialize)]
69
- pub struct TokenParam {
70
- pub name: String,
71
- pub value: TokenParamValue,
72
- }
73
-
74
- #[derive(Debug, Clone, PartialEq, Serialize)]
75
- pub enum TokenParamValue {
76
- Number(f32),
77
- String(String),
78
- Boolean(bool),
79
- Identifier(String),
80
- Map(HashMap<String, TokenParamValue>),
81
- Array(Vec<TokenParamValue>),
82
- Unknown,
83
- }
@@ -1,32 +0,0 @@
1
- use std::collections::HashMap;
2
- use serde::Serialize;
3
- use crate::core::types::token::{Token, TokenParamValue};
4
-
5
- #[derive(Debug, Clone, Serialize)]
6
- pub enum VariableValue {
7
- Number(f32),
8
- Array(Vec<Token>),
9
- Map(HashMap<String, TokenParamValue>),
10
- Text(String),
11
- Boolean(bool),
12
- Sample(String),
13
- Unknown,
14
- Null,
15
- }
16
- pub struct Variable {
17
- pub value: VariableValue,
18
- }
19
-
20
- impl Variable {
21
- pub fn from_number(value: f32) -> Self {
22
- Variable {
23
- value: VariableValue::Number(value),
24
- }
25
- }
26
-
27
- pub fn from_token(value: Token) -> Self {
28
- Variable {
29
- value: VariableValue::Text(value.lexeme),
30
- }
31
- }
32
- }
@@ -1,44 +0,0 @@
1
- use crate::core::{
2
- preprocessor::resolver::resolve_statement,
3
- types::{
4
- module::Module,
5
- statement::{ StatementKind, StatementResolved, StatementResolvedValue },
6
- },
7
- };
8
-
9
- /// Exécute tous les statements d'un module avec résolution des variables
10
- pub fn execute_statements(module: &mut Module) -> Vec<StatementResolved> {
11
- let mut resolved_statements: Vec<StatementResolved> = Vec::new();
12
-
13
- if module.clone().statements.is_empty() {
14
- return resolved_statements;
15
- }
16
-
17
- for stmt in module.clone().statements {
18
- match &stmt.kind {
19
- StatementKind::Tempo { .. } => {
20
- let resolved = resolve_statement(&stmt, module);
21
- resolved_statements.push(resolved);
22
- }
23
- StatementKind::Trigger { .. } => {
24
- let resolved = resolve_statement(&stmt, module);
25
- resolved_statements.push(resolved);
26
- }
27
- StatementKind::Bank { .. } => {
28
- let resolved = resolve_statement(&stmt, module);
29
- resolved_statements.push(resolved);
30
- }
31
- StatementKind::Loop { .. } => {
32
- let resolved = resolve_statement(&stmt, module);
33
- resolved_statements.push(resolved);
34
- }
35
- StatementKind::Load { .. } => {
36
- let resolved = resolve_statement(&stmt, module);
37
- resolved_statements.push(resolved);
38
- }
39
- _ => {}
40
- }
41
- }
42
-
43
- resolved_statements
44
- }
@@ -1 +0,0 @@
1
- pub mod executer;
File without changes
File without changes