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:
Jakob Stoklund Olesen
2016-07-01 14:23:54 -07:00
parent 7519475f91
commit cb4e9fbae0

View File

@@ -539,7 +539,7 @@ impl<'a> Parser<'a> {
let opcode = if let Some(Token::Identifier(text)) = self.token() {
match text.parse() {
Ok(opc) => opc,
Err(msg) => return err!(self.loc, msg),
Err(msg) => return err!(self.loc, "{}: '{}'", msg, text),
}
} else {
return err!(self.loc, "expected instruction opcode");