aboutsummaryrefslogtreecommitdiff
path: root/compatibility
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
commit4efe44ed271aeed8e25e909344788d92a0d9f82b (patch)
tree73766440b53031d4fc8210dbe3b0aece47e6b852 /compatibility
parentba03cb67c3c8ba53451eba25dd2186f095cd1db2 (diff)
Fully upgraded to 4.10.12.7, including deprecating the old list/dict
comprehension methods, in favor of the new native support.
Diffstat (limited to 'compatibility')
-rw-r--r--compatibility/2.3.nom4
-rw-r--r--compatibility/2.4.nom37
-rw-r--r--compatibility/2.5.5.5.nom10
-rw-r--r--compatibility/2.5.nom4
-rw-r--r--compatibility/2.nom21
-rw-r--r--compatibility/3.5.5.6.nom4
-rw-r--r--compatibility/3.6.nom6
-rw-r--r--compatibility/3.7.nom24
-rw-r--r--compatibility/3.8.nom7
-rw-r--r--compatibility/3.nom8
-rw-r--r--compatibility/4.10.12.7.nom45
-rw-r--r--compatibility/4.8.10.nom6
-rw-r--r--compatibility/4.9.nom2
-rw-r--r--compatibility/compatibility.nom42
14 files changed, 121 insertions, 99 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index df3c619..7d8fae0 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <2.3 to Nomsu 2.3
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index 2b39dd5..ef78a89 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <2.4 to Nomsu 2.4
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -10,60 +10,65 @@ upgrade %tree to "2.4" as:
unless (%tree is "Action" syntax tree): return
if %tree.stub is:
"when" "if":
- if ((size of %tree) == 3):
- return %tree
+ if ((size of %tree) == 3): return %tree
%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:
when:
(not (%line is "Action" syntax tree)):
%new_lines::add %line
+
(%line.stub is "*"):
if ((size of %line) == 2):
%conditions::add %line.2
..else:
%new_lines::add %line
+
(%line.stub == "* else"):
- %new_lines::add (\(else %block) with vars {block:%line.3})
+ %new_lines::add (\(else %block) with vars {block: %line.3})
+
else:
%conditions::add %line.2
%action = %line.3
unless (%action is "Block" syntax tree):
%action = (=lua "SyntaxTree{type='Block', source=\%action.source, \%action}")
%conditions::add %action
- %new_lines::add (=lua "SyntaxTree{type='Action', source=\%conditions[1].source, unpack(\%conditions)}")
+ %new_lines::add (..)
+ =lua "SyntaxTree{type='Action', source=\%conditions[1].source, unpack(\%conditions)}"
%conditions = []
return (..)
- \(when %body) with vars {body:=lua "SyntaxTree{type='Block', source=\%tree[2].source, unpack(\%new_lines)}"}
+ \(when %body) with vars {..}
+ body: =lua "SyntaxTree{type='Block', source=\%tree[2].source, unpack(\%new_lines)}"
"if 1 is ?" "if 1 = ?":
%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:
when:
(not (%line is "Action" syntax tree)):
%new_lines::add %line
+
(%line.stub is "*"):
if ((size of %line) == 2):
%values::add %line.2
..else:
%new_lines::add %line
+
(%line.stub == "* else"):
- %new_lines::add (\(else %block) with vars {block:%line.3})
+ %new_lines::add (\(else %block) with vars {block: %line.3})
+
else:
%values::add %line.2
%action = %line.3
- unless (%action is "Block" syntax tree):
- %action = \(: %action)
+ unless (%action is "Block" syntax tree): %action = \(: %action)
%values::add %action
- %new_lines::add (=lua "SyntaxTree{type='Action', source=\%values[1].source, unpack(\%values)}")
+ %new_lines::add (..)
+ =lua "SyntaxTree{type='Action', source=\%values[1].source, unpack(\%values)}"
%values = []
return (..)
\(if %var is %body) with vars {..}
- var:%tree.2 upgraded, body:=lua "SyntaxTree{type='Block', source=\%tree[5].source, unpack(\%new_lines)}"
+ var: %tree.2 upgraded, body: =lua "SyntaxTree{type='Block', source=\%tree[5].source, unpack(\%new_lines)}"
diff --git a/compatibility/2.5.5.5.nom b/compatibility/2.5.5.5.nom
index b7a7b21..9bbee06 100644
--- a/compatibility/2.5.5.5.nom
+++ b/compatibility/2.5.5.5.nom
@@ -1,16 +1,14 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
upgrade action [hash %, sha1 %] to "2.5.5.5" as (..)
- =lua "\
- ..\(base64 decode (hash %)):gsub('.', function(c) return ('%x02'):format(c) end)"
+ =lua "\(base64 decode (hash %)):gsub('.', function(c) return ('%x02'):format(c) end)"
upgrade action [file with hash %] to "2.5.5.5" as (..)
file with hash (..)
- base64 (..)
- =lua "\%:gsub('..', function(xx) return string.char(tonumber(xx, 16)) end)"
+ base64 (=lua "\%:gsub('..', function(xx) return string.char(tonumber(xx, 16)) end)")
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index 8c3f4d0..816691e 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <2.5 to Nomsu 2.5
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compatibility/2.nom b/compatibility/2.nom
index 84331a6..2ca4526 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu 1 to Nomsu 2
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -15,21 +15,22 @@ upgrade %tree to "2" as:
%false_body = (%tree.5 upgraded)
unless (%false_body is "Block" syntax tree):
%false_body = (=lua "Block(\%false_body.source, \%false_body)")
+
return (..)
\(if %cond %true_body else %false_body) with vars {..}
- cond:%tree.2 upgraded, true_body:%true_body, false_body:%false_body
+ cond: %tree.2 upgraded, true_body: %true_body, false_body: %false_body
%need_blocks = [..]
- "if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1"
- "repeat 1 times", "repeat", "repeat until 1", "for 1 in 2 to 3 by"
- "for 1 in 2 to 3 via", "for 1 in 2 to", "for 1 2 in"
- "do", "for 1 in recursive", "test", "with", "result of", "when"
+ "if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1", "repeat 1 times"
+ "repeat", "repeat until 1", "for 1 in 2 to 3 by", "for 1 in 2 to 3 via"
+ "for 1 in 2 to", "for 1 2 in", "do", "for 1 in recursive", "test", "with", "result of"
+ "when"
for %n in %need_blocks:
if (%tree.stub is %n):
- %bits = (((% upgraded) if (% is syntax tree) else %) for % in %tree)
+ %bits = [: for % in %tree: add ((% upgraded) if (% is syntax tree) else %)]
unless ((%bits::last) is "Block" syntax tree):
%body = (%bits::last)
- %bits.(size of %bits) = (=lua "SyntaxTree{type='Block', source=\%body.source, \%body}")
-
+ %bits.(size of %bits) = (..)
+ =lua "SyntaxTree{type='Block', source=\%body.source, \%body}"
return (=lua "SyntaxTree{type='Action', source=\%tree.source, unpack(\%bits)}")
diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom
index ff69614..db7b3a0 100644
--- a/compatibility/3.5.5.6.nom
+++ b/compatibility/3.5.5.6.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom
index b2fc5b4..1a9edb1 100644
--- a/compatibility/3.6.nom
+++ b/compatibility/3.6.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <3.6 to 3.6
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -16,11 +16,9 @@ upgrade action [add %item to %list at index %i] to "3.6" as (..)
upgrade action [pop from %list, remove last from %list] to "3.6" as (%list::pop)
upgrade action [remove index %index from %list] to "3.6" as (..)
%list::remove index %index
-
upgrade action [to %1 write %2, %1 <-write %2] to "3.6" as (%1::append %2)
upgrade action [to %1 write %2 joined by %3] to "3.6" as (..)
%1::append %2 joined by %3
-
upgrade action [declare locals in %lua] to "3.6" as (%lua::declare locals)
upgrade action [declare locals %locs in %lua] to "3.6" as (..)
%lua::declare locals %locs
diff --git a/compatibility/3.7.nom b/compatibility/3.7.nom
index 76a49e2..874b113 100644
--- a/compatibility/3.7.nom
+++ b/compatibility/3.7.nom
@@ -1,19 +1,27 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <3.7 to 3.7
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-upgrade action [%index st to last in %list] to "3.7" as (%list::%index st to last)
-upgrade action [%index nd to last in %list] to "3.7" as (%list::%index nd to last)
-upgrade action [%index rd to last in %list] to "3.7" as (%list::%index rd to last)
-upgrade action [%index th to last in %list] to "3.7" as (%list::%index rd th last)
+upgrade action [%index st to last in %list] to "3.7" as (..)
+ %list::%index st to last
+
+upgrade action [%index nd to last in %list] to "3.7" as (..)
+ %list::%index nd to last
+
+upgrade action [%index rd to last in %list] to "3.7" as (..)
+ %list::%index rd to last
+
+upgrade action [%index th to last in %list] to "3.7" as (..)
+ %list::%index rd th last
+
upgrade action [last in %list] to "3.7" as (%list::last)
upgrade action [first in %list] to "3.7" as (%list::first)
-upgrade action [%item is in %list, %list contains %item, %list has %item]
-..to "3.7" as (%list::has %item)
+upgrade action [%item is in %list, %list contains %item, %list has %item] to \
+.."3.7" as (%list::has %item)
upgrade action [..]
%item isn't in %list, %item is not in %list, %list doesn't contain %item
diff --git a/compatibility/3.8.nom b/compatibility/3.8.nom
index 0709688..583b52b 100644
--- a/compatibility/3.8.nom
+++ b/compatibility/3.8.nom
@@ -1,22 +1,19 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes)
-
+
upgrade action [%texts joined with %glue] to "3.8" as (%texts::joined with %glue)
upgrade action [%texts joined, joined %texts] to "3.8" as (%texts::joined)
upgrade action [byte %i of %text] to "3.8" as (%text::byte %i)
upgrade action [bytes %start to %stop of %text] to "3.8" as (..)
%text::bytes %start to %stop
-
upgrade action [bytes of %text] to "3.8" as (%text::bytes)
upgrade action [capitalized %text, %text capitalized] to "3.8" as (..)
%text::capitalized
-
upgrade action [uppercase %text, %text uppercase] to "3.8" as (%text::uppercase)
upgrade action [..]
%text with %sub instead of %patt, %text with %patt replaced by %sub
%text s/ %patt / %sub
..to "3.8" as (%text::with %patt -> %sub)
-
upgrade action [%text matches %pattern] to "3.8" as (%text::matches %pattern)
upgrade action [%text matching %pattern] to "3.8" as (%text::matching %pattern).1
diff --git a/compatibility/3.nom b/compatibility/3.nom
index f97bb8b..1f23897 100644
--- a/compatibility/3.nom
+++ b/compatibility/3.nom
@@ -1,7 +1,7 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <=2 to Nomsu 3
-
+
use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -10,6 +10,4 @@ upgrade action (method %spec %body) to "3" as (my action %spec %body)
upgrade action (me) to "3" as %me
upgrade action (@) to "3" as %me
upgrade action "as" to "3" via (..)
- [] -> (..)
- barf "\
- ..Object API has changed. Use (%obj::action ...) instead of (as %obj: action ...)"
+ [] -> (barf "Object API has changed. Use (%obj::action ...) instead of (as %obj: action ...)")
diff --git a/compatibility/4.10.12.7.nom b/compatibility/4.10.12.7.nom
index 4c363ab..982965b 100644
--- a/compatibility/4.10.12.7.nom
+++ b/compatibility/4.10.12.7.nom
@@ -9,22 +9,33 @@ upgrade action (% as lua statements) to "4.10.12.7" as (% as lua)
upgrade action (% as lua return) to "4.10.12.7" as (..)
=lua "\%.type == 'Block' and \(% as lua) or 'return '..\(% as lua expr)"
upgrade action (Lua value %) to "4.10.12.7" as (Lua %)
+upgrade action (%e for % in %items) to "4.10.12.7" as [: for % in %items: add %e]
+upgrade action (%e for %k = %v in %items) to "4.10.12.7" as [..]
+ : for %k = %v in %items: add %e
-upgrade action (%e for % in %items) to "4.10.12.7" as [:for % in %items: add %e]
-upgrade action (%e for %k = %v in %items) to "4.10.12.7" as [:for %k = %v in %items: add %e]
-upgrade action (%e for %i in %start to %stop) to "4.10.12.7" as [:for %i in %start to %stop: add %e]
-upgrade action (%e for %i in %start to %stop by %step) to "4.10.12.7" as (..)
- [:for %i in %start to %stop by %step: add %e]
-upgrade action (%e for %i in %start to %stop via %step) to "4.10.12.7" as (..)
- [:for %i in %start to %stop by %step: add %e]
-
-upgrade action (%k = %v for % in %items) to "4.10.12.7" as {:for % in %items: add %k = %v}
-upgrade action (%k = %v for %k0 = %v0 in %items) to "4.10.12.7" as {:for %k0 = %v0 in %items: add %k = %v}
-upgrade action (%k = %v for %i in %start to %stop) to "4.10.12.7" as {:for %i in %start to %stop: add %k = %v}
-upgrade action (%k = %v for %i in %start to %stop by %step) to "4.10.12.7" as (..)
- {:for %i in %start to %stop by %step: add %k = %v}
-upgrade action (%k = %v for %i in %start to %stop via %step) to "4.10.12.7" as (..)
- {:for %i in %start to %stop by %step: add %k = %v}
+upgrade action (%e for %i in %start to %stop) to "4.10.12.7" as [..]
+ : for %i in %start to %stop: add %e
+
+upgrade action (%e for %i in %start to %stop by %step) to "4.10.12.7" as [..]
+ : for %i in %start to %stop by %step: add %e
+
+upgrade action (%e for %i in %start to %stop via %step) to "4.10.12.7" as [..]
+ : for %i in %start to %stop by %step: add %e
+
+upgrade action (%k = %v for % in %items) to "4.10.12.7" as {..}
+ : for % in %items: add %k = %v
+
+upgrade action (%k = %v for %k0 = %v0 in %items) to "4.10.12.7" as {..}
+ : for %k0 = %v0 in %items: add %k = %v
+
+upgrade action (%k = %v for %i in %start to %stop) to "4.10.12.7" as {..}
+ : for %i in %start to %stop: add %k = %v
+
+upgrade action (%k = %v for %i in %start to %stop by %step) to "4.10.12.7" as {..}
+ : for %i in %start to %stop by %step: add %k = %v
+
+upgrade action (%k = %v for %i in %start to %stop via %step) to "4.10.12.7" as {..}
+ : for %i in %start to %stop by %step: add %k = %v
upgrade action (% as lua statements) to "4.10.12.7" as (% as lua)
upgrade action (compile error at %pos %err hint %hint) to "4.10.12.7" as (..)
@@ -38,11 +49,13 @@ upgrade %tree to "4.10.12.7" as:
repeat while (%i < (size of %first_chunk)):
if %first_has_use:
if ((%first_chunk.%i.type != "Action") or (%first_chunk.%i.stub != "use")):
- %chunk2 = (%SyntaxTree {type:"Block"})
+ %chunk2 = (%SyntaxTree {type: "Block"})
for %j in %i to (size of %first_chunk.%i):
%chunk2.((size of %chunk2) + 1) = %first_chunk.%i.%j
+
for %j in %i to (size of %first_chunk.%i):
%first_chunk.%i.%j = (nil)
+
%table.insert %tree 2 %chunk2
return %tree
..else:
diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom
index 7ea95b0..c0c17dc 100644
--- a/compatibility/4.8.10.nom
+++ b/compatibility/4.8.10.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.8.10.6
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means")
use "compatibility/compatibility.nom"
@@ -15,6 +15,7 @@ upgrade action "local action" to "4.8.10" via (..)
return \(%spec.1 means %body)
..else:
return \(%spec all mean %body)
+
else:
return \(%spec means %body)
@@ -29,6 +30,7 @@ upgrade action "action" to "4.8.10" via (..)
return \(externally %spec.1 means %body)
..else:
return \(externally %spec all mean %body)
+
else:
return \(externally %spec means %body)
..else:
@@ -44,6 +46,7 @@ upgrade action "compile 1 to" to "4.8.10" via (..)
return \(%spec.1 compiles to %body)
..else:
return \(%spec all compile to %body)
+
else:
return \(%spec compiles to %body)
@@ -57,6 +60,7 @@ upgrade action "parse 1 as" to "4.8.10" via (..)
return \(%spec.1 parses as %body)
..else:
return \(%spec all parse as %body)
+
else:
return \(%spec parse as %body)
diff --git a/compatibility/4.9.nom b/compatibility/4.9.nom
index 76df07b..e72b159 100644
--- a/compatibility/4.9.nom
+++ b/compatibility/4.9.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.9.11.6
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines upgrades from Nomsu <4.9 to 4.9
use "compatibility/compatibility.nom"
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 1df91f1..68e12e5 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -1,8 +1,8 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file contains code for defining ways to upgrade code between different versions
of Nomsu.
-
+
use "lib/os.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -10,7 +10,6 @@ use "lib/os.nom"
%UPGRADES = {}
externally (upgrade to %version via %upgrade_fn) means:
%UPGRADES.%version = %upgrade_fn
-
%ACTION_UPGRADES = ({} with fallback % -> {})
externally (upgrade action %stub to %version via %upgrade_fn) means:
%ACTION_UPGRADES.%version.%stub = %upgrade_fn
@@ -27,7 +26,6 @@ externally (upgrade action %stub to %version via %upgrade_fn) means:
for %i in 1 to (size of %action):
if (%action.%i.type is "Var"):
%replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]"
-
define mangler
(make tree %t) means:
when:
@@ -45,21 +43,20 @@ externally (upgrade action %stub to %version via %upgrade_fn) means:
%args::add (make tree %v)
..else:
%args::add "\(%k)=\(make tree %v)"
-
return "SyntaxTree{\(%args::joined with ", ")}"
- else: return (quote %t)
+ else:
+ return (quote %t)
+
+ unless ("\%lua" == ""):
+ %lua::append "\n"
- unless ("\%lua" == ""): %lua::append "\n"
%retval = (make tree %body)
%lua::append (..)
Lua "\
- ..upgrade_action_1_to_2_via(\(quote %action.stub), \(%version as lua expr), function(\(..)
- \%tree as lua id
- ..)
+ ..upgrade_action_1_to_2_via(\(quote %action.stub), \(%version as lua expr), function(\(\%tree as lua id))
return \%retval
end)"
-
return %lua
externally [..]
@@ -71,8 +68,10 @@ externally [..]
%versions = {}
for %v = % in %UPGRADES:
%versions.%v = (yes)
+
for %v = % in %ACTION_UPGRADES:
%versions.%v = (yes)
+
%versions = ((keys in %versions) sorted by % -> (% as list))
for %ver in %versions:
if ((%ver as list) <= (%start_version as list)): do next %ver
@@ -81,18 +80,18 @@ externally [..]
%tree = (..)
%tree with % ->:
if ((% is "Action" syntax tree) and %ACTION_UPGRADES.%ver.(%.stub)):
- %with_upgraded_args = (..)
- %k = (%v upgraded from %start_version to %end_version) for %k = %v in %
- set %with_upgraded_args 's metatable to (% 's metatable)
- return (..)
- %ACTION_UPGRADES.%ver.(%.stub) %with_upgraded_args %end_version
+ %with_upgraded_args = {..}
+ : for %k = %v in %: add %k = (%v upgraded from %start_version to %end_version)
+ set %with_upgraded_args's metatable to (%'s metatable)
+ return (%ACTION_UPGRADES.%ver.(%.stub) %with_upgraded_args %end_version)
if %UPGRADES.%ver:
- %with_upgraded_args = (..)
- %k = (%v upgraded from %start_version to %end_version) for %k = %v in %tree
- set %with_upgraded_args 's metatable to (%tree 's metatable)
+ %with_upgraded_args = {..}
+ :
+ for %k = %v in %tree:
+ add %k = (%v upgraded from %start_version to %end_version)
+ set %with_upgraded_args's metatable to (%tree's metatable)
%tree = (call %UPGRADES.%ver with [%with_upgraded_args, %end_version])
-
%tree.shebang = "#!/usr/bin/env nomsu -V\%end_version"
return %tree
@@ -107,7 +106,8 @@ externally (%tree upgraded) means (..)
externally (use %path from version %version) means:
for file %filename in %path:
- if (=lua "LOADED[\%filename]"): do next %filename
+ if (=lua "LOADED[\%filename]"):
+ do next %filename
%file = (read file %filename)
%tree = (parse %file from %filename)
%tree = (upgrade %tree from %version)