From a1849da175765350e013bdeecfa4e0ad3c066937 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 27 Mar 2019 15:22:46 -0700 Subject: Autoformat (mostly just to do with the new blank-line-after-end-of-multi-indent-block rule --- lib/compatibility/2.3.nom | 1 - lib/compatibility/2.4.nom | 13 +++---------- lib/compatibility/2.5.5.5.nom | 1 - lib/compatibility/2.5.nom | 1 - lib/compatibility/2.nom | 4 ++-- lib/compatibility/3.5.5.6.nom | 1 - lib/compatibility/3.6.nom | 1 - lib/compatibility/3.7.nom | 1 - lib/compatibility/3.8.nom | 1 - lib/compatibility/3.nom | 1 - lib/compatibility/4.10.12.7.nom | 4 ++-- lib/compatibility/4.11.nom | 3 ++- lib/compatibility/4.12.nom | 1 - lib/compatibility/4.8.10.nom | 2 +- lib/compatibility/4.9.nom | 2 +- lib/compatibility/6.15.9.nom | 3 +-- lib/compatibility/6.15.nom | 1 - lib/compatibility/compatibility.nom | 6 +++++- lib/compatibility/init.nom | 1 - 19 files changed, 17 insertions(+), 31 deletions(-) (limited to 'lib/compatibility') diff --git a/lib/compatibility/2.3.nom b/lib/compatibility/2.3.nom index a706c53..32d6c72 100644 --- a/lib/compatibility/2.3.nom +++ b/lib/compatibility/2.3.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 eca5d73..a035c4e 100644 --- a/lib/compatibility/2.4.nom +++ b/lib/compatibility/2.4.nom @@ -14,9 +14,7 @@ upgrade $tree to "2.4" as: return $tree $conditions = [] $new_lines = [] - $body = - $tree.2 if ($tree.2 is "Block" syntax tree) else [$tree.2] - + $body = ($tree.2 if ($tree.2 is "Block" syntax tree) else [$tree.2]) for $line in $body: when: (not ($line is "Action" syntax tree)): @@ -48,9 +46,7 @@ upgrade $tree to "2.4" as: "if 1 is ?" "if 1 = ?": $values = [] $new_lines = [] - $body = - $tree.5 if ($tree.5 is "Block" syntax tree) else [$tree.5] - + $body = ($tree.5 if ($tree.5 is "Block" syntax tree) else [$tree.5]) for $line in $body: when: (not ($line is "Action" syntax tree)): @@ -76,7 +72,4 @@ upgrade $tree to "2.4" as: $values = [] return - \( - if \($tree.2) is - \("Block" tree from $tree.5.source with (unpack $new_lines)) - ) + \(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.5.5.5.nom b/lib/compatibility/2.5.5.5.nom index dbe557d..d79e47a 100644 --- a/lib/compatibility/2.5.5.5.nom +++ b/lib/compatibility/2.5.5.5.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 e4c761c..aa14833 100644 --- a/lib/compatibility/2.5.nom +++ b/lib/compatibility/2.5.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 17ead58..20000c6 100644 --- a/lib/compatibility/2.nom +++ b/lib/compatibility/2.nom @@ -15,7 +15,7 @@ upgrade $tree to "2" as: $false_body = $tree.5 unless ($false_body is "Block" syntax tree): $false_body = (=lua "Block(\$false_body.source, \$false_body)") - return \(if \($tree.2) \$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" @@ -30,4 +30,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)}") + return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}") \ No newline at end of file diff --git a/lib/compatibility/3.5.5.6.nom b/lib/compatibility/3.5.5.6.nom index b5333b3..42ad195 100644 --- a/lib/compatibility/3.5.5.6.nom +++ b/lib/compatibility/3.5.5.6.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 c75be45..9242149 100644 --- a/lib/compatibility/3.6.nom +++ b/lib/compatibility/3.6.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### This file defines upgrades from Nomsu <3.6 to 3.6 diff --git a/lib/compatibility/3.7.nom b/lib/compatibility/3.7.nom index 1062362..6746406 100644 --- a/lib/compatibility/3.7.nom +++ b/lib/compatibility/3.7.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 d86028d..fce3772 100644 --- a/lib/compatibility/3.8.nom +++ b/lib/compatibility/3.8.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes) diff --git a/lib/compatibility/3.nom b/lib/compatibility/3.nom index 94cf24e..5181fba 100644 --- a/lib/compatibility/3.nom +++ b/lib/compatibility/3.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### 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 529b3d8..53816ca 100644 --- a/lib/compatibility/4.10.12.7.nom +++ b/lib/compatibility/4.10.12.7.nom @@ -1,5 +1,4 @@ #!/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" @@ -59,6 +58,7 @@ upgrade $tree to "4.10.12.7" as: ..else: if $has_use: go to (insert chunk) + $i += 1 return --- (insert chunk) --- @@ -74,4 +74,4 @@ upgrade $tree to "4.10.12.7" as: $new_tree = ("FileChunks" tree from $tree.source with $chunk1 $chunk2) for $i in (2 to #$tree): $new_tree.($i + 1) = $tree.$i - return $new_tree + return $new_tree \ No newline at end of file diff --git a/lib/compatibility/4.11.nom b/lib/compatibility/4.11.nom index e263c1e..9a50e77 100644 --- a/lib/compatibility/4.11.nom +++ b/lib/compatibility/4.11.nom @@ -14,6 +14,7 @@ upgrade action "call 1 with" to "4.11" via for ($i = $arg) in $tree.4: $tree2.($i + 1) = $arg return (SyntaxTree $tree2) + upgrade action ->$yield_value to "4.11" as (yield $yield_value) ### Replace set {$x:1, $y:2} with [$x, $y] = [1, 2] @@ -95,4 +96,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) +] to "4.11" as (if (any of $items) $body else $else) \ No newline at end of file diff --git a/lib/compatibility/4.12.nom b/lib/compatibility/4.12.nom index 8d73895..9af4ebe 100644 --- a/lib/compatibility/4.12.nom +++ b/lib/compatibility/4.12.nom @@ -1,5 +1,4 @@ #!/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) diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom index e278efd..bdc3484 100644 --- a/lib/compatibility/4.8.10.nom +++ b/lib/compatibility/4.8.10.nom @@ -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)) +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 3e6aaee..55a5025 100644 --- a/lib/compatibility/4.9.nom +++ b/lib/compatibility/4.9.nom @@ -9,4 +9,4 @@ upgrade action "if" to "4.9" via for $tree: if (#$tree > 2): return $tree - return \(when \$tree.2) + return \(when \$tree.2) \ No newline at end of file diff --git a/lib/compatibility/6.15.9.nom b/lib/compatibility/6.15.9.nom index 91f7267..1691af9 100644 --- a/lib/compatibility/6.15.9.nom +++ b/lib/compatibility/6.15.9.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### This file defines upgrades from Nomsu <6.15.9 to 6.15.9 @@ -18,4 +17,4 @@ upgrade action (for $x in $start to $stop $body) to "6.15.9" as upgrade action [ for $x in $start to $stop by $step $body for $x in $start to $stop via $step $body -] to "6.15.9" as (for $x in ($start to $stop by $step) $body) +] to "6.15.9" as (for $x in ($start to $stop by $step) $body) \ No newline at end of file diff --git a/lib/compatibility/6.15.nom b/lib/compatibility/6.15.nom index 88a4064..c6cf799 100644 --- a/lib/compatibility/6.15.nom +++ b/lib/compatibility/6.15.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - ### This file defines upgrades from Nomsu <6.15 to 6.15 diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom index 4cc5d74..4ccd469 100644 --- a/lib/compatibility/compatibility.nom +++ b/lib/compatibility/compatibility.nom @@ -28,6 +28,7 @@ external: for $i in (1 to #$action): if ($action.$i is "Var" syntax tree): $replacements.($action.$i.1) = "\(\$tree as lua id)[\$i]" + define mangler (make tree $t) means: when: @@ -47,6 +48,7 @@ external: $args, add (make tree $v) ..else: $args, add "\($k)=\(make tree $v)" + return "SyntaxTree{\($args, joined with ", ")}" else: @@ -63,6 +65,7 @@ external: return \$retval end) ") + return $lua [ @@ -110,6 +113,7 @@ external: $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): @@ -140,4 +144,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) + $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION) \ No newline at end of file diff --git a/lib/compatibility/init.nom b/lib/compatibility/init.nom index ded3eb8..5af4bad 100644 --- a/lib/compatibility/init.nom +++ b/lib/compatibility/init.nom @@ -1,5 +1,4 @@ #!/usr/bin/env nomsu -V7.0.0 - export "compatibility/compatibility" export "compatibility/2" export "compatibility/2.3" -- cgit v1.2.3