diff --git a/sandbox.ld b/sandbox.ld index cc29d5b..6bdf6c7 100644 --- a/sandbox.ld +++ b/sandbox.ld @@ -1,12 +1,14 @@ -let command = (:forward, 100) +let command = [:forward, 100] match command with { (:goto, (x, y)) -> "goto: {x} and {y}" + [:one, :two] -> :no (:home) -> "go home!" & (:clear) -> "clear the screen" & (:right, turns) -> "make {turns} to the right" & (:left, turns) -> "turn left! by {turns}" (:forward, steps) -> "forward {steps} turtle paces" (:back, steps) -> "flip it and reverse it {steps}" + [...xs] -> :splatted } diff --git a/src/compiler.rs b/src/compiler.rs index 687722b..e1934a3 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -662,7 +662,7 @@ impl<'a> Compiler<'a> { let jump_idx = self.stub_jump(Op::Jump); for idx in jump_idxes { - self.patch_jump(idx, self.len() - idx - 2) + self.patch_jump(idx, self.len() - idx - 3) } self.emit_op(Op::PopN); @@ -736,7 +736,7 @@ impl<'a> Compiler<'a> { let jump_idx = self.stub_jump(Op::Jump); for idx in jump_idxes { - self.patch_jump(idx, self.len() - idx - 2); + self.patch_jump(idx, self.len() - idx - 3); } self.emit_op(Op::PopN);