|
|
|
@ -37,12 +37,20 @@ impl CommandContext {
|
|
|
|
|
assign_type,
|
|
|
|
|
variable,
|
|
|
|
|
value,
|
|
|
|
|
} => match assign_type {
|
|
|
|
|
} => {
|
|
|
|
|
let value = if let Token::Keyword(keyword) = value {
|
|
|
|
|
self.context
|
|
|
|
|
.borrow()
|
|
|
|
|
.get_variables()
|
|
|
|
|
.get(keyword)
|
|
|
|
|
.unwrap_or_else(|| panic!("undefined variable `{keyword}`"))
|
|
|
|
|
.clone()
|
|
|
|
|
} else {
|
|
|
|
|
value.clone()
|
|
|
|
|
};
|
|
|
|
|
match assign_type {
|
|
|
|
|
Define => panic!("define command should not be executed at runtime!"),
|
|
|
|
|
GlobalAssign => {
|
|
|
|
|
if let Token::Keyword(_) = value {
|
|
|
|
|
todo!("assignment variable interpolation isn't implemented");
|
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
@ -58,9 +66,6 @@ impl CommandContext {
|
|
|
|
|
return None;
|
|
|
|
|
}
|
|
|
|
|
Let => {
|
|
|
|
|
if let Token::Keyword(_) = value {
|
|
|
|
|
todo!("assignment variable interpolation isn't implemented");
|
|
|
|
|
}
|
|
|
|
|
self.context
|
|
|
|
|
.borrow()
|
|
|
|
|
.variables
|
|
|
|
@ -69,9 +74,6 @@ impl CommandContext {
|
|
|
|
|
return None;
|
|
|
|
|
}
|
|
|
|
|
Assign => {
|
|
|
|
|
if let Token::Keyword(_) = value {
|
|
|
|
|
todo!("assignment variable interpolation isn't implemented");
|
|
|
|
|
}
|
|
|
|
|
let mut block_option = Some(self.context.clone());
|
|
|
|
|
let mut modified = false;
|
|
|
|
|
while let Some(block) = block_option {
|
|
|
|
@ -94,6 +96,7 @@ impl CommandContext {
|
|
|
|
|
}
|
|
|
|
|
return None;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Eat { .. } => return None,
|
|
|
|
|
}
|
|
|
|
|