diff options
Diffstat (limited to 'lib/compatibility')
| -rw-r--r-- | lib/compatibility/2.3.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/2.4.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/2.5.5.5.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/2.5.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/2.nom | 6 | ||||
| -rw-r--r-- | lib/compatibility/3.5.5.6.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/3.6.nom | 5 | ||||
| -rw-r--r-- | lib/compatibility/3.7.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/3.8.nom | 6 | ||||
| -rw-r--r-- | lib/compatibility/3.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/4.10.12.7.nom | 4 | ||||
| -rw-r--r-- | lib/compatibility/4.11.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/4.12.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/4.8.10.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/4.9.nom | 2 | ||||
| -rw-r--r-- | lib/compatibility/5.13.nom | 14 | ||||
| -rw-r--r-- | lib/compatibility/6.14.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/6.15.nom | 20 | ||||
| -rw-r--r-- | lib/compatibility/compatibility.nom | 231 | ||||
| -rw-r--r-- | lib/compatibility/init.nom | 2 |
20 files changed, 167 insertions, 159 deletions
diff --git a/lib/compatibility/2.3.nom b/lib/compatibility/2.3.nom index 67870ac..808c859 100644 --- a/lib/compatibility/2.3.nom +++ b/lib/compatibility/2.3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <2.3 to Nomsu 2.3 diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom index e0d2e02..a904dd0 100644 --- a/lib/compatibility/2.4.nom +++ b/lib/compatibility/2.4.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <2.4 to Nomsu 2.4 diff --git a/lib/compatibility/2.5.5.5.nom b/lib/compatibility/2.5.5.5.nom index c026a42..93d3956 100644 --- a/lib/compatibility/2.5.5.5.nom +++ b/lib/compatibility/2.5.5.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5 diff --git a/lib/compatibility/2.5.nom b/lib/compatibility/2.5.nom index 03b3f61..b5b988a 100644 --- a/lib/compatibility/2.5.nom +++ b/lib/compatibility/2.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <2.5 to Nomsu 2.5 diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom index caf7a86..ca3cb6a 100644 --- a/lib/compatibility/2.nom +++ b/lib/compatibility/2.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu 1 to Nomsu 2 @@ -24,8 +24,8 @@ upgrade $tree to "2" as: $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" + "for 1 in 2 to", "for 1 2 in", "do", "for 1 in recursive", "test", "with" + "result of", "when" ] for $n in $need_blocks: diff --git a/lib/compatibility/3.5.5.6.nom b/lib/compatibility/3.5.5.6.nom index 6528526..d9bba4f 100644 --- a/lib/compatibility/3.5.5.6.nom +++ b/lib/compatibility/3.5.5.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6 diff --git a/lib/compatibility/3.6.nom b/lib/compatibility/3.6.nom index 5db2aae..7428158 100644 --- a/lib/compatibility/3.6.nom +++ b/lib/compatibility/3.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <3.6 to 3.6 @@ -7,7 +7,8 @@ use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upgrade action [ - append $item to $list, add $item to $list, to $list add $item, to $list append $item + append $item to $list, add $item to $list, to $list add $item + to $list append $item ] to "3.6" as ($list, add $item) upgrade action [add $item to $list at index $i] to "3.6" as diff --git a/lib/compatibility/3.7.nom b/lib/compatibility/3.7.nom index ed877a6..894c656 100644 --- a/lib/compatibility/3.7.nom +++ b/lib/compatibility/3.7.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <3.7 to 3.7 diff --git a/lib/compatibility/3.8.nom b/lib/compatibility/3.8.nom index 398e3bb..0c3b3ac 100644 --- a/lib/compatibility/3.8.nom +++ b/lib/compatibility/3.8.nom @@ -1,11 +1,11 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes) - + use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + 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) diff --git a/lib/compatibility/3.nom b/lib/compatibility/3.nom index af5c2fd..966dbf9 100644 --- a/lib/compatibility/3.nom +++ b/lib/compatibility/3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <=2 to Nomsu 3 diff --git a/lib/compatibility/4.10.12.7.nom b/lib/compatibility/4.10.12.7.nom index c241898..eeff2f2 100644 --- a/lib/compatibility/4.10.12.7.nom +++ b/lib/compatibility/4.10.12.7.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <4.10.12.7 to 4.10.12.7 use "compatibility/compatibility" @@ -8,9 +8,7 @@ use "compatibility/compatibility" 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] diff --git a/lib/compatibility/4.11.nom b/lib/compatibility/4.11.nom index 24dbbdc..88ea7b3 100644 --- a/lib/compatibility/4.11.nom +++ b/lib/compatibility/4.11.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <4.11 to Nomsu 4.11 (overhaul of function literals, deleting (if all of ...), etc. shorthand) @@ -25,9 +25,7 @@ upgrade action "set" to "4.11" via for $entry in $tree.2 at $i: $lhs.$i = $entry.1 $rhs.$i = $entry.2 - - return - SyntaxTree {.type = "Action", .source = $tree.source} $lhs "=" $rhs + return (SyntaxTree {.type = "Action", .source = $tree.source} $lhs "=" $rhs) upgrade action "1 with 2 ~>" to "4.11" via for $tree: @@ -93,5 +91,6 @@ upgrade action [ ] to "4.11" as (if (not (any of $items)) $body else $else) upgrade action [ - unless none of $items $body else $else, unless none of $items then $body else $else + 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) diff --git a/lib/compatibility/4.12.nom b/lib/compatibility/4.12.nom index a76e7df..bb1af0b 100644 --- a/lib/compatibility/4.12.nom +++ b/lib/compatibility/4.12.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <4.11 to Nomsu 4.11 (overhaul of function literals, deleting (if all of ...), etc. shorthand) diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom index 250dc4a..15a502b 100644 --- a/lib/compatibility/4.8.10.nom +++ b/lib/compatibility/4.8.10.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means") use "compatibility/compatibility" diff --git a/lib/compatibility/4.9.nom b/lib/compatibility/4.9.nom index 14b5dd6..d8260a4 100644 --- a/lib/compatibility/4.9.nom +++ b/lib/compatibility/4.9.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <4.9 to 4.9 use "compatibility/compatibility" diff --git a/lib/compatibility/5.13.nom b/lib/compatibility/5.13.nom index 1e0db6d..92c8ebe 100644 --- a/lib/compatibility/5.13.nom +++ b/lib/compatibility/5.13.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V5.13 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <5.13 to 5.13 use "compatibility/compatibility" @@ -6,19 +6,15 @@ use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upgrade action (size of $) to "5.13" as (#$) - -upgrade action "with" to "5.13" via (..) +upgrade action "with" to "5.13" via for $tree: $assignments = $tree.2 $body = $tree.3 - if ($assignments.type != "Dict"): - return $tree + if ($assignments.type != "Dict"): return $tree $new_assignments = \[] for $a in $assignments at $i: when: - (($a.type == "DictEntry") and ((#$a) == 1)): - $a = $a.1 - (all of [$a.type == "DictEntry", (#$a) == 2]): - $a = \($a.1 = $a.2) + (($a.type == "DictEntry") and ((#$a) == 1)): $a = $a.1 + (all of [$a.type == "DictEntry", (#$a) == 2]): $a = \($a.1 = $a.2) $new_assignments.$i = $a return \(with $new_assignments $body) diff --git a/lib/compatibility/6.14.nom b/lib/compatibility/6.14.nom index 8443157..0e742d0 100644 --- a/lib/compatibility/6.14.nom +++ b/lib/compatibility/6.14.nom @@ -1,6 +1,7 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines upgrades from Nomsu <6.14 to 6.14 + use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -26,16 +27,12 @@ upgrade action (assume $assumption or barf $err) to "6.14" as unless $assumption: fail $err upgrade action (barf $msg) to "6.14" as (fail $msg) - upgrade action (\(1's meaning)).stub to "6.14" via $tree -> (SyntaxTree {.source = $tree.source, .type = "Var", $tree.1}) - upgrade action (log base $b of $n) to "6.14" as (log $n base $b) - upgrade action "use" to "6.14" via for $tree: $path = $tree.2.1 $path = ($path, with "%.nom$" -> "") $path = ($path, with "^lib/" -> "") - return \(use (SyntaxTree {.source = $tree.2.source, .type="Text"} $path)) - + return \(use (SyntaxTree {.source = $tree.2.source, .type = "Text"} $path)) diff --git a/lib/compatibility/6.15.nom b/lib/compatibility/6.15.nom new file mode 100644 index 0000000..a911624 --- /dev/null +++ b/lib/compatibility/6.15.nom @@ -0,0 +1,20 @@ +#!/usr/bin/env nomsu -V6.15.13.8 +# + This file defines upgrades from Nomsu <6.15 to 6.15 + +use "compatibility/compatibility" + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +upgrade action (external $x = $y) to "6.15" as (external ($x = $y)) +upgrade action (externally $x means $y) to "6.15" as (external ($x means $y)) +upgrade action (externally $x all mean $y) to "6.15" as + external ($x all mean $y) + +upgrade action ($lists flattened) to "6.15" as [ + : for $ in recursive $lists: + if ($ is a "List"): + for $child in $: + recurse $ on $child + ..else: add $ +] diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom index 8e48903..419f589 100644 --- a/lib/compatibility/compatibility.nom +++ b/lib/compatibility/compatibility.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file contains code for defining ways to upgrade code between different versions of Nomsu. @@ -8,126 +8,123 @@ use "filesystem" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $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 - -(upgrade $tree to $version as $body) parses as - upgrade to $version via (($ $end_version) -> ($ with $tree -> $body)) - -(upgrade action $actions to $version as $body) compiles to: - if ($actions is "Action" syntax tree): - $actions = \[$actions] - $lua = (Lua "") - for $action in $actions: - $replacements = {} - for $i in 1 to (size of $action): - if ($action.$i is "Var" syntax tree): - $replacements.($action.$i.1) = "\(\$tree as lua id)[\$i]" - define mangler - (make tree $t) means: - when: - ($t is "Var" syntax tree): - if $replacements.($t.1): - return $replacements.($t.1) - ..else: - external $needs_mangle = (yes) - return (" - SyntaxTree{type=\(quote $t.type), source=\(quote "\($t.source)"), \(quote (mangle $t.1))} - ") - - ($t is syntax tree): - $args = [] - for $k = $v in $t: - if ((type of $k) == "number"): - $args, add (make tree $v) +external: + (upgrade to $version via $upgrade_fn) means: + $UPGRADES.$version = $upgrade_fn + + (upgrade action $stub to $version via $upgrade_fn) means: + $ACTION_UPGRADES.$version.$stub = $upgrade_fn + + (upgrade $tree to $version as $body) parses as + upgrade to $version via (($ $end_version) -> ($ with $tree -> $body)) + + (upgrade action $actions to $version as $body) compiles to: + if ($actions is "Action" syntax tree): + $actions = \[$actions] + $lua = (Lua "") + for $action in $actions: + $replacements = {} + for $i in 1 to (size of $action): + if ($action.$i is "Var" syntax tree): + $replacements.($action.$i.1) = "\(\$tree as lua id)[\$i]" + define mangler + (make tree $t) means: + when: + ($t is "Var" syntax tree): + if $replacements.($t.1): + return $replacements.($t.1) ..else: - $args, add "\($k)=\(make tree $v)" - return "SyntaxTree{\($args, joined with ", ")}" - - else: - return (quote $t) + external ($needs_mangle = (yes)) + return (" + SyntaxTree{type=\(quote $t.type), source=\(quote "\($t.source)"), \(quote (mangle $t.1))} + ") + + ($t is syntax tree): + $args = [] + for $k = $v in $t: + if ((type of $k) == "number"): + $args, add (make tree $v) + ..else: + $args, add "\($k)=\(make tree $v)" + return "SyntaxTree{\($args, joined with ", ")}" + + else: + return (quote $t) + + unless ("\$lua" == ""): + $lua, add "\n" + + $retval = (make tree $body) + $lua, add + Lua (" + upgrade_action_1_to_2_via(\(quote $action.stub), \($version as lua expr), function(\ + ..\(\$tree as lua id)) + return \$retval + end) + ") + return $lua + + [ + $tree upgraded from $start_version to $end_version + $tree upgraded to $end_version from $start_version + ] all mean: + unless ($tree is syntax tree): return $tree + ($ver as list) means (($ as number) for $ in $ver matching "[0-9]+") + (Ver $) means: + [$lib, $ver] = ($, match "(.*)/([0-9.]+)") + if $lib: + return {.lib = $lib, .version = ($ver as list)} + return {.version = ($ as list)} + $start = (Ver $start_version) + $end = (Ver $end_version) + $end.lib or= $start.lib + assume $start.lib == $end.lib + $seen = {} + $versions = {} + for $v = $ in $UPGRADES: + $versions.$v = (yes) - unless ("\$lua" == ""): - $lua, add "\n" + for $v = $ in $ACTION_UPGRADES: + $versions.$v = (yes) - $retval = (make tree $body) - $lua, add - Lua (" - upgrade_action_1_to_2_via(\(quote $action.stub), \($version as lua expr), function(\ - ..\(\$tree as lua id)) - return \$retval - end) - ") - return $lua - -externally [ - $tree upgraded from $start_version to $end_version - $tree upgraded to $end_version from $start_version -] all mean: - unless ($tree is syntax tree): return $tree - - ($ver as list) means (($ as number) for $ in $ver matching "[0-9]+") - - (Ver $) means: - [$lib, $ver] = ($, match "(.*)/([0-9.]+)") - if $lib: - return {.lib = $lib, .version = ($ver as list)} - return {.version = ($ as list)} - - $start = (Ver $start_version) - $end = (Ver $end_version) - $end.lib or= $start.lib - assume $start.lib == $end.lib - - $seen = {} - $versions = {} - for $v = $ in $UPGRADES: $versions.$v = (yes) - for $v = $ in $ACTION_UPGRADES: $versions.$v = (yes) - $versions = [ - :for $v = $ in $versions: - if ((Ver $v).lib == $start.lib): - add $v - ] - - sort $versions by $ -> ($ as list) - for $ver in $versions: - if (($ver as list) <= $start.version): do next $ver - if (($ver as list) > $end.version): stop $ver - if $ACTION_UPGRADES.$ver: - $tree = - $tree with $ ->: - if (($ is "Action" syntax tree) and $ACTION_UPGRADES.$ver.($.stub)): - $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) + $versions = [: for $v = $ in $versions: if ((Ver $v).lib == $start.lib): add $v] + sort $versions by $ -> ($ as list) + for $ver in $versions: + if (($ver as list) <= $start.version): do next $ver + if (($ver as list) > $end.version): stop $ver + if $ACTION_UPGRADES.$ver: + $tree = + $tree with $ ->: + if (($ is "Action" syntax tree) and $ACTION_UPGRADES.$ver.($.stub)): + $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 = { + : 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) + + if ($tree.version != $end_version): + $tree = (SyntaxTree {: for $k = $v in $tree: add $k = $v}) + $tree.version = $end_version + if $tree.shebang: + $tree.shebang = "#!/usr/bin/env nomsu -V\$end_version\n" - 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) + return $tree - if ($tree.version != $end_version): - $tree = (SyntaxTree {: for $k = $v in $tree: add $k = $v}) - $tree.version = $end_version - if $tree.shebang: - $tree.shebang = "#!/usr/bin/env nomsu -V\$end_version\n" + ($tree upgraded from $start_version) means + $tree upgraded from $start_version to (Nomsu version) - return $tree - -externally ($tree upgraded from $start_version) means - $tree upgraded from $start_version to (Nomsu version) - -externally ($tree upgraded to $end_version) means - $tree upgraded from ($tree.version or (Nomsu version)) to $end_version - -externally ($tree upgraded) means - $tree upgraded from ($tree.version or (Nomsu version)) to (Nomsu version) + ($tree upgraded to $end_version) means + $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) diff --git a/lib/compatibility/init.nom b/lib/compatibility/init.nom index 40cafff..42834bb 100644 --- a/lib/compatibility/init.nom +++ b/lib/compatibility/init.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14.13.8 +#!/usr/bin/env nomsu -V6.15.13.8 export "compatibility/compatibility" export "compatibility/2" export "compatibility/2.3" |
