diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/macro_processor/macro_processor.rs | 12 | ||||
-rw-r--r-- | src/skaldpress/parseopts.rs | 2 |
2 files changed, 13 insertions, 1 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 diff --git a/src/skaldpress/parseopts.rs b/src/skaldpress/parseopts.rs index 36fbf13..3985684 100644 --- a/src/skaldpress/parseopts.rs +++ b/src/skaldpress/parseopts.rs @@ -135,7 +135,7 @@ pub fn parseopts() -> OptsBuilder { } else { arg_name = arg.clone(); match arg_name.as_str() { - "out" | "source" | "templates" => { + "out" | "source" | "templates" | "filter" => { arg_value = it.next(); } _ => (), |