Give a better error message for unknown opcodes.
Include the name of the unrecognized opcode along with the line number.
This commit is contained in:
@@ -539,7 +539,7 @@ impl<'a> Parser<'a> {
|
|||||||
let opcode = if let Some(Token::Identifier(text)) = self.token() {
|
let opcode = if let Some(Token::Identifier(text)) = self.token() {
|
||||||
match text.parse() {
|
match text.parse() {
|
||||||
Ok(opc) => opc,
|
Ok(opc) => opc,
|
||||||
Err(msg) => return err!(self.loc, msg),
|
Err(msg) => return err!(self.loc, "{}: '{}'", msg, text),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return err!(self.loc, "expected instruction opcode");
|
return err!(self.loc, "expected instruction opcode");
|
||||||
|
|||||||
Reference in New Issue
Block a user