|
|
|
@ -1,11 +1,12 @@
|
|
|
|
|
use std::{collections::HashMap, rc::Rc};
|
|
|
|
|
use debug_cell::RefCell;
|
|
|
|
|
use std::{collections::HashMap, rc::Rc};
|
|
|
|
|
|
|
|
|
|
use super::{
|
|
|
|
|
command::{parse_command, Command},
|
|
|
|
|
control::{parse_control, Control},
|
|
|
|
|
event::Event,
|
|
|
|
|
token::Token,
|
|
|
|
|
Pair, Rule, event::Event,
|
|
|
|
|
Pair, Rule,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pub struct CommandBlock {
|
|
|
|
@ -35,24 +36,21 @@ impl CommandContext {
|
|
|
|
|
if let Token::Keyword(_) = value {
|
|
|
|
|
todo!("assignment variable interpolation isn't implemented");
|
|
|
|
|
}
|
|
|
|
|
let root = self.context
|
|
|
|
|
.borrow()
|
|
|
|
|
.get_root(&self.context);
|
|
|
|
|
let root = self.context.borrow().get_root(&self.context);
|
|
|
|
|
// Don't want to re-borrow if root is self
|
|
|
|
|
let root = if Rc::ptr_eq(&self.context, &root) {
|
|
|
|
|
&self.context
|
|
|
|
|
} else {
|
|
|
|
|
&root
|
|
|
|
|
};
|
|
|
|
|
root
|
|
|
|
|
.borrow_mut()
|
|
|
|
|
root.borrow_mut()
|
|
|
|
|
.variables
|
|
|
|
|
.as_ref()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.borrow_mut()
|
|
|
|
|
.insert(variable.clone(), value.clone());
|
|
|
|
|
return None;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
Eat { .. } => return None,
|
|
|
|
|
}
|
|
|
|
|
.process(&self.context),
|
|
|
|
|