Allow trimming of whitespace

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-09 13:24:40 +01:00
parent 587cfdea53
commit 59f92e31fe
8 changed files with 243 additions and 9 deletions

View file

@ -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);