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
@@ -2,7 +2,7 @@
extern crate log;
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};
@@ -24,7 +24,7 @@ impl CrsnExtension for ScreenOps {
"screen"
}
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;
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::ScreenOp;
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 {
"sc-init" => {
ScreenOp::ScreenInit {