cleanup. remove conditional jumps, replaced by condition embedded in the enum

This commit is contained in:
2020-10-04 23:30:11 +02:00
parent 810ed2dddc
commit 986f3be6a2
28 changed files with 172 additions and 181 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
use crsn::asm::error::CrsnError;
use crsn::asm::instr::Op;
use crsn::asm::instr::op::OpKind;
use crsn::asm::parse::arg_parser::TokenParser;
use crsn::module::{CrsnExtension, ParseRes};
@@ -21,7 +21,7 @@ impl CrsnExtension for ArithOps {
"arith"
}
fn parse_op<'a>(&self, keyword: &str, args: TokenParser<'a>) -> Result<ParseRes<'a, Op>, CrsnError> {
fn parse_op<'a>(&self, keyword: &str, args: TokenParser<'a>) -> Result<ParseRes<'a, OpKind>, CrsnError> {
parse::parse(keyword, args)
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
use crsn::asm::data::{Rd, Wr};
use crsn::asm::error::CrsnError;
use crsn::asm::instr::Op;
use crsn::asm::instr::op::OpKind;
use crsn::asm::parse::arg_parser::TokenParser;
use crsn::module::ParseRes;
use crate::defs::ArithOp;
pub(crate) fn parse<'a>(keyword: &str, mut args: TokenParser<'a>) -> Result<ParseRes<'a, Op>, CrsnError> {
pub(crate) fn parse<'a>(keyword: &str, mut args: TokenParser<'a>) -> Result<ParseRes<'a, OpKind>, CrsnError> {
Ok(ParseRes::ext(match keyword {
"cmp" => {
ArithOp::Compare {