diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-07-17 15:09:36 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-12 07:33:40 +0100 |
| commit | 376dcb684ce779a7051bbc9a95359114e94cae5e (patch) | |
| tree | 7bff7cc3dcbb4055efffcb3a172fc4aa238e9380 /lib/xixanta/src/context.rs | |
| parent | 7822c00e8689c99ded0a360026f4e7ace1f2c87f (diff) | |
| download | tools.nes-376dcb684ce779a7051bbc9a95359114e94cae5e.tar.gz tools.nes-376dcb684ce779a7051bbc9a95359114e94cae5e.zip | |
Add support for procedures
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à <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/context.rs')
| -rw-r--r-- | lib/xixanta/src/context.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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; |
