aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compatibility/2.4.nom12
-rw-r--r--lib/compatibility/2.nom10
-rw-r--r--lib/compatibility/4.11.nom6
-rw-r--r--lib/compatibility/4.8.10.nom10
-rw-r--r--lib/compatibility/4.9.nom4
-rw-r--r--lib/compatibility/compatibility.nom44
6 files changed, 43 insertions, 43 deletions
diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom
index 480257a..eca5d73 100644
--- a/lib/compatibility/2.4.nom
+++ b/lib/compatibility/2.4.nom
@@ -15,7 +15,7 @@ upgrade $tree to "2.4" as:
$conditions = []
$new_lines = []
$body =
- ($tree.2 upgraded) if ($tree.2 is "Block" syntax tree) else [$tree.2 upgraded]
+ $tree.2 if ($tree.2 is "Block" syntax tree) else [$tree.2]
for $line in $body:
when:
@@ -29,7 +29,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add (else \$line.3)
+ $new_lines, add \(else \$line.3)
else:
$conditions, add $line.2
@@ -49,7 +49,7 @@ upgrade $tree to "2.4" as:
$values = []
$new_lines = []
$body =
- ($tree.5 upgraded) if ($tree.5 is "Block" syntax tree) else [$tree.5 upgraded]
+ $tree.5 if ($tree.5 is "Block" syntax tree) else [$tree.5]
for $line in $body:
when:
@@ -63,7 +63,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add (else \$line.3)
+ $new_lines, add \(else \$line.3)
else:
$values, add $line.2
@@ -77,6 +77,6 @@ upgrade $tree to "2.4" as:
return
\(
- if \($tree.2 upgraded) is
+ if \($tree.2) is
\("Block" tree from $tree.5.source with (unpack $new_lines))
- ) \ No newline at end of file
+ )
diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom
index 69f2d41..17ead58 100644
--- a/lib/compatibility/2.nom
+++ b/lib/compatibility/2.nom
@@ -9,13 +9,13 @@ use "compatibility/compatibility"
upgrade $tree to "2" as:
unless ($tree is "Action" syntax tree): return
if ($tree.stub == "if 1 2 else"):
- $true_body = ($tree.3 upgraded)
+ $true_body = $tree.3
unless ($true_body is "Block" syntax tree):
$true_body = ("Block" tree with $true_body)
- $false_body = ($tree.5 upgraded)
+ $false_body = $tree.5
unless ($false_body is "Block" syntax tree):
$false_body = (=lua "Block(\$false_body.source, \$false_body)")
- return \(if \($tree.2 upgraded) \$true_body else \$false_body)
+ return \(if \($tree.2) \$true_body else \$false_body)
$need_blocks = [
"if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1", "repeat 1 times"
@@ -26,8 +26,8 @@ upgrade $tree to "2" as:
for $n in $need_blocks:
if ($tree.stub == $n):
- $bits = [: for $ in $tree: add (($ upgraded) if ($ is syntax tree) else $)]
+ $bits = [: for $ in $tree: add ($ if ($ is syntax tree) else $)]
unless (($bits, last) is "Block" syntax tree):
$body = ($bits, last)
$bits.(#$bits) = (=lua "SyntaxTree{type='Block', source=\$body.source, \$body}")
- return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}") \ No newline at end of file
+ return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}")
diff --git a/lib/compatibility/4.11.nom b/lib/compatibility/4.11.nom
index d5a158b..e263c1e 100644
--- a/lib/compatibility/4.11.nom
+++ b/lib/compatibility/4.11.nom
@@ -9,7 +9,7 @@ use "compatibility/compatibility"
### Overhaul of function literals:
upgrade action "call 1 with" to "4.11" via
- for ($tree $end_version):
+ for $tree:
$tree2 = {.type = "Action", .source = $tree.source, .1 = $tree.2}
for ($i = $arg) in $tree.4:
$tree2.($i + 1) = $arg
@@ -18,7 +18,7 @@ upgrade action ->$yield_value to "4.11" as (yield $yield_value)
### Replace set {$x:1, $y:2} with [$x, $y] = [1, 2]
upgrade action "set" to "4.11" via
- for ($tree $end_version):
+ for $tree:
[$lhs, $rhs] = [\[], \[]]
$lhs.source = $tree.2.source
$rhs.source = $tree.2.source
@@ -95,4 +95,4 @@ upgrade action [
upgrade action [
unless none of $items $body else $else
unless none of $items then $body else $else
-] to "4.11" as (if (any of $items) $body else $else) \ No newline at end of file
+] to "4.11" as (if (any of $items) $body else $else)
diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom
index 5723b0d..e278efd 100644
--- a/lib/compatibility/4.8.10.nom
+++ b/lib/compatibility/4.8.10.nom
@@ -6,7 +6,7 @@ use "compatibility/compatibility"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
upgrade action "local action" to "4.8.10" via
- for ($tree $end_version):
+ for $tree:
$spec = $tree.3
$body = $tree.4
if $spec.type is:
@@ -20,7 +20,7 @@ upgrade action "local action" to "4.8.10" via
return \(\$spec means \$body)
upgrade action "action" to "4.8.10" via
- for ($tree $end_version):
+ for $tree:
$spec = $tree.2
$body = $tree.3
if $body:
@@ -37,7 +37,7 @@ upgrade action "action" to "4.8.10" via
return \((\$spec)'s meaning)
upgrade action "compile 1 to" to "4.8.10" via
- for ($tree $end_version):
+ for $tree:
$spec = $tree.2
$body = $tree.4
if $spec.type is:
@@ -51,7 +51,7 @@ upgrade action "compile 1 to" to "4.8.10" via
return \(\$spec compiles to \$body)
upgrade action "parse 1 as" to "4.8.10" via
- for ($tree $end_version):
+ for $tree:
$spec = $tree.2
$body = $tree.4
if $spec.type is:
@@ -65,4 +65,4 @@ upgrade action "parse 1 as" to "4.8.10" via
return \(\$spec parse as \$body)
upgrade action (compile as $) to "4.8.10" as (what $ compiles to)
-upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil)) \ No newline at end of file
+upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil))
diff --git a/lib/compatibility/4.9.nom b/lib/compatibility/4.9.nom
index 0ec8bc8..3e6aaee 100644
--- a/lib/compatibility/4.9.nom
+++ b/lib/compatibility/4.9.nom
@@ -6,7 +6,7 @@ use "compatibility/compatibility"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
upgrade action "if" to "4.9" via
- for ($tree $end_version):
+ for $tree:
if (#$tree > 2):
return $tree
- return \(when \$tree.2) \ No newline at end of file
+ return \(when \$tree.2)
diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom
index 4715282..01ba24f 100644
--- a/lib/compatibility/compatibility.nom
+++ b/lib/compatibility/compatibility.nom
@@ -17,7 +17,7 @@ external:
$ACTION_UPGRADES.$version.$stub = $upgrade_fn
(upgrade $tree to $version as $body) parses as
- upgrade to $version via (($ $end_version) -> ($, with ($tree -> $body)))
+ upgrade to $version via ($ -> ($, with ($tree -> $body)))
(upgrade action $actions to $version as $body) compiles to:
if ($actions is "Action" syntax tree):
@@ -97,31 +97,31 @@ external:
for ($v = $) in $ACTION_UPGRADES:
$versions.$v = (yes)
- $versions =
- [: for ($v = $) in $versions: if ((Ver $v).lib == $start.lib): add $v]
+ $versions = [:
+ for ($v = $) in $versions:
+ $v2 = (Ver $v)
+ if ($v2.lib == $start.lib):
+ if ($start.version < $v2.version <= $end.version): add $v
+ ]
sort $versions by $ -> ($ as version list)
+ $curr_version = $start_version
for $ver in $versions:
- if (($ver as version list) <= $start.version): do next $ver
- if (($ver as version list) > $end.version): stop $ver
- if $ACTION_UPGRADES.$ver:
- $tree =
- $tree, with
- $ ->:
- if ($ is "Action" syntax tree):
- $(upgrade 1 to 2) = $ACTION_UPGRADES.$ver.($.stub)
- if $(upgrade 1 to 2):
- $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 (upgrade $with_upgraded_args to $end_version)
+ $tree =
+ SyntaxTree
+ {: for ($k = $v) in $tree: add $k = ($v upgraded from $curr_version to $ver)}
+ if (($tree.type == "Action") and $ACTION_UPGRADES.$ver):
+ $(upgrade 1) = $ACTION_UPGRADES.$ver.($tree, get stub)
+ if $(upgrade 1):
+ $tree = (upgrade $tree)
+ go to (next version)
if $UPGRADES.$ver:
- $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 = ($UPGRADES.$ver $with_upgraded_args $end_version)
+ $tree = ($UPGRADES.$ver $tree $ver)
+ go to (next version)
+
+ --- (next version) ---
+ $curr_version = $ver
if ($tree.version != $end_version):
$tree = (SyntaxTree {: for ($k = $v) in $tree: add $k = $v})
@@ -138,4 +138,4 @@ external:
$tree upgraded from ($tree.version or $(NOMSU VERSION)) to $end_version
($tree upgraded) means
- $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION) \ No newline at end of file
+ $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION)