aboutsummaryrefslogtreecommitdiff
path: root/compatibility/2.4.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-20 20:27:15 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-20 20:27:27 -0700
commit6728587dfc6a5f4090f2673113ffedb2be924daf (patch)
tree77591abacd8760bedaa30110570613ef263220fe /compatibility/2.4.nom
parentc9df1bc3e881b2ebcf5808a0db7bea29cd07c849 (diff)
Auto-formatted and auto-upgraded everything!
Diffstat (limited to 'compatibility/2.4.nom')
-rw-r--r--compatibility/2.4.nom32
1 files changed, 26 insertions, 6 deletions
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index ae0cfba..479d1d2 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.4
+#!/usr/bin/env nomsu -V2.5.4.3
use "core"
use "compatibility/compatibility.nom"
@@ -8,49 +8,69 @@ upgrade %tree to "2.4" as:
"when %":
%conditions = []
%new_lines = []
- %body = ((%tree.2 upgraded) if (%tree.2 is "Block" syntax tree) else [%tree.2 upgraded])
+ %body = (..)
+ (%tree.2 upgraded) if (%tree.2 is "Block" syntax tree) else [%tree.2 upgraded]
+
for %line in %body:
if:
(not (%line is syntax tree)):
compile error at %tree.source "WUT: %s"
+
(not (%line is "Action" syntax tree)):
add %line to %new_lines
+
(%line.stub is "* %"):
add %line.2 to %conditions
+
(%line.stub == "* else %"):
add (\(else %block) with vars {block:%line.3}) to %new_lines
+
(%line.stub != "* % %"):
add %line to %new_lines
+
else:
add %line.2 to %conditions
%action = %line.3
unless (%action is "Block" syntax tree):
%action = (=lua "Block(\%action.source, \%action)")
+
add %action to %conditions
add (=lua "Action(\%conditions[1].source, unpack(\%conditions))") to %new_lines
%conditions = []
- return (\(if %body) with vars {body:=lua "Block(\%tree[2].source, unpack(\%new_lines))"})
-
+
+ return (..)
+ \(if %body) with vars {body:=lua "Block(\%tree[2].source, unpack(\%new_lines))"}
+
"when % is ? %" "when % = ? %":
%values = []
%new_lines = []
- %body = ((%tree.5 upgraded) if (%tree.5 is "Block" syntax tree) else [%tree.5 upgraded])
+ %body = (..)
+ (%tree.5 upgraded) if (%tree.5 is "Block" syntax tree) else [%tree.5 upgraded]
+
for %line in %body:
if:
(not (%line is "Action" syntax tree)):
add %line to %new_lines
+
(%line.stub is "* %"):
add %line.2 to %values
+
(%line.stub == "* else %"):
add (\(else %block) with vars {block:%line.3}) to %new_lines
+
(%line.stub != "* % %"):
add %line to %new_lines
+
else:
add %line.2 to %values
%action = %line.3
unless (%action is "Block" syntax tree):
%action = (=lua "Block(\%action.source, \%action)")
+
add %action to %values
add (=lua "Action(\%values[1].source, unpack(\%values))") to %new_lines
%values = []
- return (\(if %var is %body) with vars {var: %tree.2 upgraded, body:=lua "Block(\%tree[5].source, unpack(\%new_lines))"})
+
+ return (..)
+ \(if %var is %body) with vars {..}
+ var:%tree.2 upgraded, body:=lua "Block(\%tree[5].source, unpack(\%new_lines))" \ No newline at end of file