From 376dcb684ce779a7051bbc9a95359114e94cae5e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 17 Jul 2024 15:09:36 +0200 Subject: Add support for procedures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Procedures are marked with the '.proc' control statement and work both as a scoping mechanism and as a label that can be referenced. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/context.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/xixanta/src/context.rs') diff --git a/lib/xixanta/src/context.rs b/lib/xixanta/src/context.rs index aade200..a4ffc5b 100644 --- a/lib/xixanta/src/context.rs +++ b/lib/xixanta/src/context.rs @@ -62,6 +62,15 @@ impl Context { self.map.entry(name).or_default(); } + pub fn push_stack(&mut self, identifier: &String) { + let name = match self.stack.last() { + Some(n) => n.to_owned() + &String::from("::") + identifier, + None => identifier.to_string(), + }; + + self.stack.push(name.clone()); + } + pub fn pop(&mut self) -> bool { if self.stack.is_empty() { return false; -- cgit v1.2.3