diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-03-20 15:55:57 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-03-20 15:55:57 -0700 |
| commit | e665d9725c4bb02f4c18d16527367f424cb880fa (patch) | |
| tree | aed161ee6b338c2bad2312591f746459414ccafa /lib/compatibility | |
| parent | 606fd090002f3d545cbd58440e96624907846f45 (diff) | |
Auto-updated to 7.0.0 syntax and removed some shims.
Diffstat (limited to 'lib/compatibility')
| -rw-r--r-- | lib/compatibility/2.3.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/2.4.nom | 31 | ||||
| -rw-r--r-- | lib/compatibility/2.5.5.5.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/2.5.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/2.nom | 13 | ||||
| -rw-r--r-- | lib/compatibility/3.5.5.6.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/3.6.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/3.7.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/3.8.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/3.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/4.10.12.7.nom | 25 | ||||
| -rw-r--r-- | lib/compatibility/4.11.nom | 23 | ||||
| -rw-r--r-- | lib/compatibility/4.12.nom | 7 | ||||
| -rw-r--r-- | lib/compatibility/4.8.10.nom | 39 | ||||
| -rw-r--r-- | lib/compatibility/4.9.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/5.13.nom | 18 | ||||
| -rw-r--r-- | lib/compatibility/6.14.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/6.15.9.nom | 5 | ||||
| -rw-r--r-- | lib/compatibility/6.15.nom | 11 | ||||
| -rw-r--r-- | lib/compatibility/7.nom | 16 | ||||
| -rw-r--r-- | lib/compatibility/compatibility.nom | 36 | ||||
| -rw-r--r-- | lib/compatibility/init.nom | 5 |
22 files changed, 162 insertions, 143 deletions
diff --git a/lib/compatibility/2.3.nom b/lib/compatibility/2.3.nom index 808c859..a706c53 100644 --- a/lib/compatibility/2.3.nom +++ b/lib/compatibility/2.3.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <2.3 to Nomsu 2.3 use "compatibility/compatibility" @@ -7,7 +8,7 @@ use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ upgrade action ($a = $b) to "2.3" as ($a == $b) -upgrade action (<- $) to "2.3" as (set $) +upgrade action <-$ to "2.3" as (set $) upgrade action (assign $) to "2.3" as (set $) upgrade action ($a <- $b) to "2.3" as ($a = $b) upgrade action (external $a <- $b) to "2.3" as (external $a = $b) @@ -17,4 +18,4 @@ upgrade action ($a *<- $b) to "2.3" as ($a *= $b) upgrade action ($a /<- $b) to "2.3" as ($a /= $b) upgrade action ($a ^<- $b) to "2.3" as ($a ^= $b) upgrade action ($a and<- $b) to "2.3" as ($a and= $b) -upgrade action ($a or<- $b) to "2.3" as ($a or= $b) +upgrade action ($a or<- $b) to "2.3" as ($a or= $b)
\ No newline at end of file diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom index 1296777..17a2df5 100644 --- a/lib/compatibility/2.4.nom +++ b/lib/compatibility/2.4.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <2.4 to Nomsu 2.4 use "compatibility/compatibility" @@ -10,7 +11,7 @@ upgrade $tree to "2.4" as: unless ($tree is "Action" syntax tree): return if $tree.stub is: "when" "if": - if ((#$tree) == 3): + if (#$tree == 3): return $tree $conditions = [] $new_lines = [] @@ -23,13 +24,13 @@ upgrade $tree to "2.4" as: $new_lines, add $line ($line.stub == "*"): - if ((#$line) == 2): + if (#$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 ("Action" tree with "else" $line.3) else: $conditions, add $line.2 @@ -44,10 +45,8 @@ upgrade $tree to "2.4" as: $conditions = [] return - \(when $body) with vars { - .body = - =lua "SyntaxTree{type='Block', source=\$tree[2].source, unpack(\$new_lines)}" - } + "Action" tree with "when" + "Block" tree from $tree.2.source with (unpack $new_lines) "if 1 is ?" "if 1 = ?": $values = [] @@ -61,26 +60,24 @@ upgrade $tree to "2.4" as: $new_lines, add $line ($line.stub == "*"): - if ((#$line) == 2): + if (#$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 ("Action" tree with "else" $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 = ("Block" tree with $action) $values, add $action $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)}" - }
\ No newline at end of file + "Action" tree with "if" ($tree.2 upgraded) "is" + "Block" tree from $tree.5.source with (unpack $new_lines) diff --git a/lib/compatibility/2.5.5.5.nom b/lib/compatibility/2.5.5.5.nom index 93d3956..dbe557d 100644 --- a/lib/compatibility/2.5.5.5.nom +++ b/lib/compatibility/2.5.5.5.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5 use "compatibility/compatibility" @@ -14,4 +15,4 @@ upgrade action [hash $, sha1 $] to "2.5.5.5" as 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)" + =lua "\$:gsub('..', function(xx) return string.char(tonumber(xx, 16)) end)"
\ No newline at end of file diff --git a/lib/compatibility/2.5.nom b/lib/compatibility/2.5.nom index b5b988a..e4c761c 100644 --- a/lib/compatibility/2.5.nom +++ b/lib/compatibility/2.5.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <2.5 to Nomsu 2.5 use "compatibility/compatibility" @@ -10,4 +11,4 @@ upgrade action (for $1 where $2 matches $3 $4) to "2.5" as for $1 in $2 matching $3 $4 upgrade action ($1 for $2 where $3 matches $4) to "2.5" as - $1 for $2 in $3 matching $4 + $1 for $2 in $3 matching $4
\ No newline at end of file diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom index 782ccb0..2deeca2 100644 --- a/lib/compatibility/2.nom +++ b/lib/compatibility/2.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu 1 to Nomsu 2 use "compatibility/compatibility" @@ -11,15 +12,13 @@ upgrade $tree to "2" as: if ($tree.stub == "if 1 2 else"): $true_body = ($tree.3 upgraded) unless ($true_body is "Block" syntax tree): - $true_body = \(: $true_body) + $true_body = ("Block" tree with $true_body) $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 - } + "Action" tree with "if" ($tree.2 upgraded) $true_body "else" $false_body $need_blocks = [ "if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1", "repeat 1 times" @@ -34,4 +33,4 @@ upgrade $tree to "2" as: 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/3.5.5.6.nom b/lib/compatibility/3.5.5.6.nom index 9887498..b5333b3 100644 --- a/lib/compatibility/3.5.5.6.nom +++ b/lib/compatibility/3.5.5.6.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6 use "compatibility/compatibility" @@ -8,4 +9,4 @@ use "compatibility/compatibility" upgrade action "traceback" to "3.5.5.6" via for $tree: - at $tree fail "Upgrade error: 'traceback' has been deprecated." + at $tree fail "Upgrade error: 'traceback' has been deprecated."
\ No newline at end of file diff --git a/lib/compatibility/3.6.nom b/lib/compatibility/3.6.nom index 7428158..c75be45 100644 --- a/lib/compatibility/3.6.nom +++ b/lib/compatibility/3.6.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <3.6 to 3.6 use "compatibility/compatibility" @@ -28,4 +29,4 @@ upgrade action [add free vars $vars to $lua] to "3.6" as $lua, add free vars $vars upgrade action [remove free vars $vars from $lua] to "3.6" as - $lua, remove free vars $vars + $lua, remove free vars $vars
\ No newline at end of file diff --git a/lib/compatibility/3.7.nom b/lib/compatibility/3.7.nom index 894c656..1062362 100644 --- a/lib/compatibility/3.7.nom +++ b/lib/compatibility/3.7.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <3.7 to 3.7 use "compatibility/compatibility" @@ -38,4 +39,4 @@ upgrade action [ upgrade action [ number of keys in $list, len $list, || $list ||, length $list, length of $list -] to "3.7" as (size of $list) +] to "3.7" as (size of $list)
\ No newline at end of file diff --git a/lib/compatibility/3.8.nom b/lib/compatibility/3.8.nom index 0c3b3ac..d86028d 100644 --- a/lib/compatibility/3.8.nom +++ b/lib/compatibility/3.8.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes) use "compatibility/compatibility" @@ -20,4 +21,4 @@ upgrade action [ $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 +upgrade action [$text matching $pattern] to "3.8" as ($text, matching $pattern).1
\ No newline at end of file diff --git a/lib/compatibility/3.nom b/lib/compatibility/3.nom index 6ce3fdc..94cf24e 100644 --- a/lib/compatibility/3.nom +++ b/lib/compatibility/3.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <=2 to Nomsu 3 use "compatibility/compatibility" @@ -14,4 +15,4 @@ upgrade action "as" to "3" via at $tree fail (" Upgrade error: Object API has changed and 'as' is no longer supported. Hint: Use ($obj, action ...) instead of (as $obj: action ...) - ") + ")
\ No newline at end of file diff --git a/lib/compatibility/4.10.12.7.nom b/lib/compatibility/4.10.12.7.nom index f134476..529b3d8 100644 --- a/lib/compatibility/4.10.12.7.nom +++ b/lib/compatibility/4.10.12.7.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <4.10.12.7 to 4.10.12.7 use "compatibility/compatibility" @@ -22,10 +23,8 @@ upgrade action ($e for $i in $start to $stop by $step) to "4.10.12.7" as 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 $ 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} @@ -40,13 +39,13 @@ 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 (parse $text from $filename) to "4.10.12.7" as - (NomsuCode from (Source $filename 1 (#$text)) $text) parsed + (NomsuCode from (Source $filename 1 #$text) $text) parsed 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 compile error at $pos $err $hint -# In old code, it was okay to have imports at the top of the file in the same chunk, +### In old code, it was okay to have imports at the top of the file in the same chunk, but changes to the API now require imports to be in their own file chunk in order for compilation to work properly. upgrade $tree to "4.10.12.7" as: @@ -54,7 +53,7 @@ upgrade $tree to "4.10.12.7" as: $first_chunk = $tree.1 $i = 1 $has_use = (no) - repeat while ($i <= (#$first_chunk)): + repeat while ($i <= #$first_chunk): if (($first_chunk.$i.type == "Action") and ($first_chunk.$i.stub == "use")): $has_use = (yes) ..else: @@ -66,13 +65,13 @@ upgrade $tree to "4.10.12.7" as: [$chunk1, $chunk2] = ["Block" tree from $first_chunk.source, "Block" tree from $first_chunk.source] - for $j in 1 to ($i - 1): + for $j in (1 to ($i - 1)): $chunk1.$j = $first_chunk.$j - for $j in $i to (#$first_chunk): + for $j in ($i to #$first_chunk): $chunk2.($j - $i + 1) = $first_chunk.$j $new_tree = ("FileChunks" tree from $tree.source with $chunk1 $chunk2) - for $i in 2 to (#$tree): + for $i in (2 to #$tree): $new_tree.($i + 1) = $tree.$i - return $new_tree
\ No newline at end of file + return $new_tree diff --git a/lib/compatibility/4.11.nom b/lib/compatibility/4.11.nom index e30734d..e91f034 100644 --- a/lib/compatibility/4.11.nom +++ b/lib/compatibility/4.11.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <4.11 to Nomsu 4.11 (overhaul of function literals, deleting (if all of ...), etc. shorthand) @@ -7,22 +8,22 @@ use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Overhaul of function literals: +### Overhaul of function literals: upgrade action "call 1 with" to "4.11" via for ($tree $end_version): $tree2 = {.type = "Action", .source = $tree.source, .1 = $tree.2} - for $arg in $tree.4 at $i: + for ($i = $arg) in $tree.4: $tree2.($i + 1) = $arg return (SyntaxTree $tree2) -upgrade action (-> $yield_value) to "4.11" as (yield $yield_value) +upgrade action ->$yield_value to "4.11" as (yield $yield_value) -# Replace set {$x:1, $y:2} with [$x, $y] = [1, 2] +### Replace set {$x:1, $y:2} with [$x, $y] = [1, 2] upgrade action "set" to "4.11" via for ($tree $end_version): - [$lhs, $rhs] = [\[], \[]] + [$lhs, $rhs] = [`[], `[]] $lhs.source = $tree.2.source $rhs.source = $tree.2.source - for $entry in $tree.2 at $i: + for ($i = $entry) in $tree.2: $lhs.$i = $entry.1 $rhs.$i = $entry.2 return ("Action" tree from $tree.source with $lhs "=" $rhs) @@ -34,7 +35,7 @@ upgrade action "1 with 2 ~>" to "4.11" via Hint: Perhaps this could be use ($tree, map ...) instead. ") -# Changing filesystem API: +### Changing filesystem API: upgrade action (for file $f in $path $body) to "4.11" as for $f in (files for $path) $body @@ -45,7 +46,7 @@ upgrade action (line $n in $text) to "4.11" as ($text, line $n) upgrade action (line number of $pos in $text) to "4.11" as $text, line number at $pos -# Deduplicating goto labels: +### Deduplicating goto labels: upgrade action [=== $label ===, *** $label ***] to "4.11" as (--- $label ---) upgrade action [===stop $label ===, ***stop $label ***] to "4.11" as ---stop $label --- @@ -53,7 +54,7 @@ upgrade action [===stop $label ===, ***stop $label ***] to "4.11" as upgrade action [===next $label ===, ***next $label ***] to "4.11" as ---next $label --- -# Deprecating shorthand functions: +### Deprecating shorthand functions: upgrade action [if all of $items $body, if all of $items then $body] to "4.11" as if (all of $items) $body diff --git a/lib/compatibility/4.12.nom b/lib/compatibility/4.12.nom index 033f6ed..8d73895 100644 --- a/lib/compatibility/4.12.nom +++ b/lib/compatibility/4.12.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <4.11 to Nomsu 4.11 (overhaul of function literals, deleting (if all of ...), etc. shorthand) @@ -19,4 +20,4 @@ upgrade action "stop repeating" to "4.12" via at $tree fail (" Upgrade error: This method has been deprecated. Hint: Use either (stop) or (go to (label)) instead. - ") + ")
\ No newline at end of file diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom index 71d69d0..3ec7421 100644 --- a/lib/compatibility/4.8.10.nom +++ b/lib/compatibility/4.8.10.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means") use "compatibility/compatibility" @@ -11,13 +12,13 @@ upgrade action "local action" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((#$spec) == 1): - return \($spec.1 means $body) + if (#$spec == 1): + return ("Action" tree with $spec.1 "means" $body) ..else: - return \($spec all mean $body) + return ("Action" tree with $spec "all" "mean" $body) else: - return \($spec means $body) + return ("Action" tree with $spec "means" $body) upgrade action "action" to "4.8.10" via for ($tree $end_version): @@ -26,15 +27,15 @@ upgrade action "action" to "4.8.10" via if $body: if $spec.type is: "List": - if ((#$spec) == 1): - return \(externally $spec.1 means $body) + if (#$spec == 1): + return ("Action" tree with "externally" $spec.1 "means" $body) ..else: - return \(externally $spec all mean $body) + return ("Action" tree with "externally" $spec "all" "mean" $body) else: - return \(externally $spec means $body) + return ("Action" tree with "externally" $spec "means" $body) ..else: - return \($spec's meaning) + return ("Action" tree with $spec "'" "s" "meaning") upgrade action "compile 1 to" to "4.8.10" via for ($tree $end_version): @@ -42,13 +43,13 @@ upgrade action "compile 1 to" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((#$spec) == 1): - return \($spec.1 compiles to $body) + if (#$spec == 1): + return ("Action" tree with $spec.1 "compiles" "to" $body) ..else: - return \($spec all compile to $body) + return ("Action" tree with $spec "all" "compile" "to" $body) else: - return \($spec compiles to $body) + return ("Action" tree with $spec "compiles" "to" $body) upgrade action "parse 1 as" to "4.8.10" via for ($tree $end_version): @@ -56,13 +57,13 @@ upgrade action "parse 1 as" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((#$spec) == 1): - return \($spec.1 parses as $body) + if (#$spec == 1): + return ("Action" tree with $spec.1 "parses" "as" $body) ..else: - return \($spec all parse as $body) + return ("Action" tree with $spec "all" "parse" "as" $body) else: - return \($spec parse as $body) + return ("Action" tree with $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 diff --git a/lib/compatibility/4.9.nom b/lib/compatibility/4.9.nom index 67d40c5..9371f8c 100644 --- a/lib/compatibility/4.9.nom +++ b/lib/compatibility/4.9.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <4.9 to 4.9 use "compatibility/compatibility" @@ -7,6 +8,6 @@ use "compatibility/compatibility" upgrade action "if" to "4.9" via for ($tree $end_version): - if ((#$tree) > 2): + if (#$tree > 2): return $tree - return \(when $tree.2)
\ No newline at end of file + return ("Action" tree with "when" $tree.2)
\ No newline at end of file diff --git a/lib/compatibility/5.13.nom b/lib/compatibility/5.13.nom index 92c8ebe..c2ab90e 100644 --- a/lib/compatibility/5.13.nom +++ b/lib/compatibility/5.13.nom @@ -1,20 +1,22 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <5.13 to 5.13 use "compatibility/compatibility" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -upgrade action (size of $) to "5.13" as (#$) +upgrade action (size of $) to "5.13" as #$ upgrade action "with" to "5.13" via for $tree: $assignments = $tree.2 $body = $tree.3 if ($assignments.type != "Dict"): return $tree - $new_assignments = \[] - for $a in $assignments at $i: + $new_assignments = `[] + for ($i = $a) in $assignments: 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 = ("Action" tree with $a.1 "=" $a.2) $new_assignments.$i = $a - return \(with $new_assignments $body) + return ("Action" tree with "with" $new_assignments $body) diff --git a/lib/compatibility/6.14.nom b/lib/compatibility/6.14.nom index b11474b..b809afd 100644 --- a/lib/compatibility/6.14.nom +++ b/lib/compatibility/6.14.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <6.14 to 6.14 use "compatibility/compatibility" @@ -27,7 +28,7 @@ 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 +upgrade action ("Action" tree with 1 "'" "s" "meaning").stub to "6.14" via $tree -> ("Var" tree from $tree.source with $tree.1) upgrade action (log base $b of $n) to "6.14" as (log $n base $b) upgrade action "use" to "6.14" via @@ -35,4 +36,4 @@ upgrade action "use" to "6.14" via $path = $tree.2.1 $path = ($path, with "%.nom$" -> "") $path = ($path, with "^lib/" -> "") - return \(use ("Text" tree from $tree.2.source with $path)) + return ("Action" tree with "use" ("Text" tree from $tree.2.source with $path))
\ No newline at end of file diff --git a/lib/compatibility/6.15.9.nom b/lib/compatibility/6.15.9.nom index d10167f..91f7267 100644 --- a/lib/compatibility/6.15.9.nom +++ b/lib/compatibility/6.15.9.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.9 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <6.15.9 to 6.15.9 use "compatibility/compatibility" diff --git a/lib/compatibility/6.15.nom b/lib/compatibility/6.15.nom index ed892c1..88a4064 100644 --- a/lib/compatibility/6.15.nom +++ b/lib/compatibility/6.15.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file defines upgrades from Nomsu <6.15 to 6.15 use "compatibility/compatibility" @@ -11,8 +12,8 @@ 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: +upgrade action ($lists flattened) to "6.15" as [: + for $ in recursive $lists: if ($ is "a List"): for $child in $: recurse $ on $child @@ -29,4 +30,4 @@ upgrade action ($x is $y) to "6.15" as ($x == $y) upgrade action [$a isn't $b, $a is not $b, $a not= $b] to "6.15" as ($a != $b) upgrade action [$a is a $b, $a is an $b] to "6.15" as ($a is $b) upgrade action [$a isn't a $b, $a isn't an $b, $a is not a $b, $a is not an $b] -..to "6.15" as ($a isn't $b) +..to "6.15" as ($a isn't $b)
\ No newline at end of file diff --git a/lib/compatibility/7.nom b/lib/compatibility/7.nom index df60f21..c84be0c 100644 --- a/lib/compatibility/7.nom +++ b/lib/compatibility/7.nom @@ -1,4 +1,5 @@ -#!/usr/bin/env nomsu -V7 +#!/usr/bin/env nomsu -V7.0.0 + ### This file defines upgrades from Nomsu <7 to 7 @@ -33,10 +34,15 @@ upgrade action (for $var in $start to $stop $body) to "7" as upgrade $tree to "7" as: if ($tree.type == "EscapedNomsu"): $t = - "Action" tree from $tree.source with ("Text" tree with $tree.1.type) "tree" "with" + "Action" tree from $tree.source with ("Text" tree with $tree.1.type) "tree" + "with" + for $tok in $tree.1: - if ($tok is "Text"): $t, add ("Text" tree with $tok) - ..else: $t, add $tok + if ($tok is "Text"): + $t, add ("Text" tree with $tok) + ..else: + $t, add $tok + return $t upgrade action "Nomsu version" to "7" via ->(`$(NOMSU VERSION)) @@ -47,4 +53,4 @@ upgrade action [ at $.source fail (" Deprecation error: Actions for accessing specific parts of the version number have been deprecated. Hint: Use $(NOMSU VERSION).1, etc. instead. - ") + ")
\ No newline at end of file diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom index 123f4d9..5ae261f 100644 --- a/lib/compatibility/compatibility.nom +++ b/lib/compatibility/compatibility.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### This file contains code for defining ways to upgrade code between different versions of Nomsu. @@ -21,13 +22,13 @@ external: (upgrade action $actions to $version as $body) compiles to: if ($actions is "Action" syntax tree): - $actions = \[$actions] + $actions = ("List" tree with $actions) $lua = (Lua "") for $action in $actions: $replacements = {} - for $i in 1 to (#$action): + for $i in (1 to #$action): if ($action.$i is "Var" syntax tree): - $replacements.($action.$i.1) = "\(\$tree as lua id)[\$i]" + $replacements.($action.$i.1) = "\(`$tree as lua id)[\$i]" define mangler (make tree $t) means: when: @@ -42,7 +43,7 @@ external: ($t is syntax tree): $args = [] - for $k = $v in $t: + for ($k = $v) in $t: if ((type of $k) == "a Number"): $args, add (make tree $v) ..else: @@ -59,7 +60,7 @@ external: $lua, add Lua (" upgrade_action_1_to_2_via(\(quote $action.stub), \($version as lua expr), function(\ - ..\(\$tree as lua id)) + ..\(`$tree as lua id)) return \$retval end) ") @@ -91,13 +92,15 @@ external: assume $start.lib == $end.lib $seen = {} $versions = {} - for $v = $ in $UPGRADES: + for ($v = $) in $UPGRADES: $versions.$v = (yes) - for $v = $ in $ACTION_UPGRADES: + 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: if ((Ver $v).lib == $start.lib): add $v] + sort $versions by $ -> ($ as version list) for $ver in $versions: if (($ver as version list) <= $start.version): do next $ver @@ -109,23 +112,20 @@ external: 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) - } + $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) if $UPGRADES.$ver: - $with_upgraded_args = { - : for $k = $v in $tree: + $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 = (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" @@ -139,4 +139,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) diff --git a/lib/compatibility/init.nom b/lib/compatibility/init.nom index 90d2ca5..ded3eb8 100644 --- a/lib/compatibility/init.nom +++ b/lib/compatibility/init.nom @@ -1,4 +1,5 @@ -#!/usr/bin/env nomsu -V6.15.13.8 +#!/usr/bin/env nomsu -V7.0.0 + export "compatibility/compatibility" export "compatibility/2" export "compatibility/2.3" @@ -19,4 +20,4 @@ export "compatibility/5.13" export "compatibility/6.14" export "compatibility/6.15" export "compatibility/6.15.9" -export "compatibility/7" +export "compatibility/7"
\ No newline at end of file |
