add unsym and undef

pull/21/head
Ondřej Hruška 4 years ago
parent e580a2b679
commit 4336454156
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 20
      crsn/src/builtin/parse.rs

@ -71,6 +71,16 @@ impl CrsnExtension for BuiltinOps {
return Ok(ParseRes::ParsedNone);
}
"unsym" => {
let alias = parse_reg_alias(args.next())?;
let mut pstate = pcx.state.borrow_mut();
if pstate.reg_aliases.remove(&alias).is_none() {
return Err(CrsnError::Parse(format!("Register alias \"{}\" not defined!", alias).into()));
}
return Ok(ParseRes::ParsedNone);
}
"def" => {
let name = parse_constant_name(args.next())?;
let value = parse_value(args.next())?;
@ -89,6 +99,16 @@ impl CrsnExtension for BuiltinOps {
return Ok(ParseRes::ParsedNone);
}
"undef" => {
let name = parse_constant_name(args.next())?;
let mut pstate = pcx.state.borrow_mut();
if pstate.constants.remove(&name).is_none() {
return Err(CrsnError::Parse(format!("Constant \"{}\" not defined!", name).into()));
}
return Ok(ParseRes::ParsedNone);
}
"j" => {
let dest = parse_label(args.next())?;
BuiltinOp::Jump(dest)

Loading…
Cancel
Save