diff --git a/crsn/src/builtin/parse.rs b/crsn/src/builtin/parse.rs index 75b231d..6880f48 100644 --- a/crsn/src/builtin/parse.rs +++ b/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)