summaryrefslogtreecommitdiff
path: root/src/macro_processor
diff options
context:
space:
mode:
Diffstat (limited to 'src/macro_processor')
-rw-r--r--src/macro_processor/macro_processor.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/macro_processor/macro_processor.rs b/src/macro_processor/macro_processor.rs
index 85bf8e1..96d5471 100644
--- a/src/macro_processor/macro_processor.rs
+++ b/src/macro_processor/macro_processor.rs
@@ -246,6 +246,7 @@ pub enum MacroType {
),
/// Will be expanded in-place to the String
String(String),
+ Array(Vec<MacroType>),
}
/// Possible parser states
@@ -339,6 +340,17 @@ impl MacroProcessor {
self.macros.insert(name, macro_expansion);
}
+ pub fn array_push(&mut self, name: String, element: MacroType) -> Result<(), SMPError> {
+ let Some(macro_body) = self.macros.get_mut(&name) else {
+ return Err(SMPError::UnknownError(4, None));
+ };
+ let MacroType::Array(array) = macro_body else {
+ return Err(SMPError::UnknownError(5, None));
+ };
+ array.push(element);
+ Ok(())
+ }
+
/// This expands a macro definition, and it executes builtin functions, like define
///
/// # Arguments