diff options
Diffstat (limited to 'src/parsers/assembler.rs')
-rw-r--r-- | src/parsers/assembler.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/parsers/assembler.rs b/src/parsers/assembler.rs index eb180e3..61e1a84 100644 --- a/src/parsers/assembler.rs +++ b/src/parsers/assembler.rs @@ -115,7 +115,7 @@ impl<'a> Environment<'a> { } else if let Some(definition) = self.macro_definitions.get(name) { self.reify_value(&definition.value) } else if let Some(label) = self.label_definitions.get(name) { - let name = Tracked::from(self.tag_label_name(&label.name), &source); + let name = Tracked::from(self.tag_label_name(&label.name), source); Ok(Argument::Integer(IntegerArgument::LabelReference(name))) } else { let variant = ErrVar::DefinitionNotFound(name.to_string()); @@ -142,9 +142,12 @@ impl<'a> Environment<'a> { IntegerArgument::Expression(expr) } Integer::LabelReference(name) => { - let name = Tracked::from(self.tag_label_name(name), &name.source); + let name = Tracked::from(self.tag_label_name(name), name.source.clone()); IntegerArgument::LabelReference(name) } + Integer::String(string) => { + IntegerArgument::String(string.clone()) + } }; Ok(Argument::Integer(value)) } @@ -238,7 +241,7 @@ impl<'a> Environment<'a> { if received != expected { return err!(ErrVar::IncorrectArgumentCount(expected, received)); } - let name = Tracked::from(self.tag_label_name(&label.name), &label.source); + let name = Tracked::from(self.tag_label_name(&label.name), label.source.clone()); Ok(Argument::Integer(IntegerArgument::LabelReference(name))) } else { err!(ErrVar::DefinitionNotFound(invocation.name.to_string())) @@ -270,6 +273,11 @@ impl<'a> Environment<'a> { IntegerArgument::Expression(expr) => { AssembledExpressionToken::Expression(Box::new(expr)) }, + IntegerArgument::String(string) => { + let source = string.source.clone(); + let variant = AssemblerErrorVariant::StringInExpression; + return Err(AssemblerError { source, variant }) + } } } ExprVar::Error(_) => continue, |