Allow trimming of whitespace
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
587cfdea53
commit
59f92e31fe
8 changed files with 243 additions and 9 deletions
|
|
@ -53,11 +53,12 @@ pub fn execute(
|
|||
Instruction::PushScope { inherit_parent: _ } => todo!(),
|
||||
Instruction::Abort => return Err(EvaluationError::ExplicitAbort),
|
||||
Instruction::JumpIfNotTrue { emit_slot, jump } => {
|
||||
let jump = if *jump == 0 { 1 } else { *jump };
|
||||
let dont_jump = scopes.get(emit_slot).unwrap().as_bool().unwrap();
|
||||
if dont_jump {
|
||||
// We are done
|
||||
} else {
|
||||
let (new_ip, overflow) = ip.overflowing_add_signed(*jump);
|
||||
let (new_ip, overflow) = ip.overflowing_add_signed(jump);
|
||||
|
||||
if overflow {
|
||||
return Err(EvaluationError::InstructionPointerOverflow);
|
||||
|
|
@ -68,7 +69,8 @@ pub fn execute(
|
|||
}
|
||||
}
|
||||
Instruction::Jump { jump } => {
|
||||
let (new_ip, overflow) = ip.overflowing_add_signed(*jump);
|
||||
let jump = if *jump == 0 { 1 } else { *jump };
|
||||
let (new_ip, overflow) = ip.overflowing_add_signed(jump);
|
||||
|
||||
if overflow {
|
||||
return Err(EvaluationError::InstructionPointerOverflow);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue