Convert builtin ops into a pseudo-extension

This commit is contained in:
2020-09-26 22:00:27 +02:00
parent 1d444fd516
commit 3e0aaa71e9
18 changed files with 441 additions and 297 deletions
+5 -6
View File
@@ -1,11 +1,10 @@
use crsn::asm::data::{Rd, Wr};
use crsn::asm::error::{Error};
use crsn::asm::error::Error;
use crsn::asm::instr::op::{AsmModule, ParseOpResult};
use crsn::asm::instr::Op;
use crsn::asm::parse::arg_parser::ArgParser;
use crate::defs::ArithOp;
use crsn::asm::parse::arg_parser::ArgParser;
#[derive(Debug, Clone)]
pub struct ArithOpParser {
@@ -26,7 +25,7 @@ impl AsmModule for ArithOpParser {
}
fn parse_op(&self, keyword: &str, mut args: ArgParser) -> Result<ParseOpResult, Error> {
Ok(ParseOpResult::Parsed(Box::new(match keyword {
Ok(ParseOpResult::Parsed(Op::Ext(Box::new(match keyword {
"cmp" => {
ArithOp::Compare {
a: args.next_rd()?,
@@ -451,6 +450,6 @@ impl AsmModule for ArithOpParser {
_other => {
return Ok(ParseOpResult::Unknown(args));
}
})))
}))))
}
}