From 21d853ac27ed3751087750051dd97e68a0502c3b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 14 Apr 2023 11:42:12 +0200 Subject: Simplify 5.1.3 affected events with new instruction pair. if_space or_space Gets compiled to: if can_vm_place(1, s => ) space 1 else space 1 endif Interleaving if/else and space/endspace is safe. --- tools/gencode.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools') diff --git a/tools/gencode.js b/tools/gencode.js index 30f12c9..df8f0f1 100644 --- a/tools/gencode.js +++ b/tools/gencode.js @@ -43,6 +43,17 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) { console.log("// SHADED " + line[1]) break + case "if_space": + emit([ "if", "()=>can_vm_space(1,(s)=>" + line.slice(1).join(" ") + ")" ]) + emit([ "space", true, 1, 1, "(s)=>" + line.slice(1).join(" ") ]) + emit([ "else" ]) + break + + case "or_space": + emit([ "space", true, 1, 1, "(s)=>" + line.slice(1).join(" ") ]) + emit([ "endif" ]) + break + case "space_no_undo": emit([ "space", false, line[1], line[1], "(s)=>" + line.slice(2).join(" ") ]) break -- cgit v1.2.3