diff options
Diffstat (limited to 'compatibility')
| -rw-r--r-- | compatibility/2.nom | 4 | ||||
| -rw-r--r-- | compatibility/compatibility.nom | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/compatibility/2.nom b/compatibility/2.nom index 35ed1a0..a93730c 100644 --- a/compatibility/2.nom +++ b/compatibility/2.nom @@ -4,7 +4,7 @@ use "compatibility/compatibility.nom" upgrade %tree to "2" as: unless (%tree is "Action" syntax tree): return - if (all[%tree.stub is "if % % else %", not (%tree.3 is "Var" syntax tree), not (%tree.5 is "Var" syntax tree)]): + if (%tree.stub is "if % % else %"): %true_body = (%tree.3 upgraded) unless (%true_body is "Block" syntax tree): %true_body = (=lua "Block(\%true_body.source, \%true_body)") @@ -22,7 +22,7 @@ upgrade %tree to "2" as: "for % in % to % via % %", "for % in % to % %", "for % % in % %", "do %" "for % in recursive % %", "test %", "with % %", "result of %" for %n in %need_blocks: - if ((%tree.stub is %n) and (not ((last in %tree) is "Var" syntax tree))): + if (%tree.stub is %n): %bits = (((% upgraded) if (% is syntax tree) else %) for % in %tree) unless ((last in %bits) is "Block" syntax tree): %body = (last in %bits) diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index 9482e32..c5ac55f 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -21,16 +21,16 @@ compile [upgrade action %action to %version as %body] to: %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]" local action [make tree %t]: when: - * (%t is "Var" syntax tree): + (%t is "Var" syntax tree): if (%replacements.(%t.1)): return %replacements.(%t.1) ..else: return "\(%t.type)(\(quote "\(%t.source)"), \(quote "\(%t.1) \0\(=lua "string.format('%X', __MANGLE_INDEX)")"))" - * (%t is syntax tree): + (%t is syntax tree): %args = ((make tree %) for % in %t) add "\(\%tree as lua id).source" to %args at index 1 return "\(%t.type)(\(%args joined with ", "))" - *else: return (quote "\%t") + else: return (quote "\%t") return (..) Lua ".." A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(\%tree as lua id)) @@ -66,9 +66,9 @@ parse [%tree upgraded from %start_version] as (..) %tree upgraded from %start_version to (Nomsu version) parse [%tree upgraded to %end_version] as (..) - %tree upgraded from %tree.version to %end_version + %tree upgraded from (%tree.version or "0") to %end_version -parse [%tree upgraded] as (%tree upgraded from %tree.version to (Nomsu version)) +parse [%tree upgraded] as (%tree upgraded from (%tree.version or "0") to (Nomsu version)) action [use %path from version %version] (..) for file %filename in %path: if (=lua "LOADED[\%filename]"): do next %filename |
