aboutsummaryrefslogtreecommitdiff
path: root/lib/compatibility/4.10.12.7.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-14 17:14:34 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-14 17:14:57 -0800
commitddef8be3df626d63f6e575d4c1416295a22371ad (patch)
tree78af9584447b085f06d6412d2cc20137a460848b /lib/compatibility/4.10.12.7.nom
parent9fceff7e785bb234971b443809eef3da9051c598 (diff)
Moved compatibility to lib/ and fixed path searching for .peg files.
Diffstat (limited to 'lib/compatibility/4.10.12.7.nom')
-rw-r--r--lib/compatibility/4.10.12.7.nom85
1 files changed, 85 insertions, 0 deletions
diff --git a/lib/compatibility/4.10.12.7.nom b/lib/compatibility/4.10.12.7.nom
new file mode 100644
index 0000000..c241898
--- /dev/null
+++ b/lib/compatibility/4.10.12.7.nom
@@ -0,0 +1,85 @@
+#!/usr/bin/env nomsu -V6.14
+#
+ This file defines upgrades from Nomsu <4.10.12.7 to 4.10.12.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]
+
+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 (parse $text from $filename) to "4.10.12.7" as
+ (NomsuCode from (Source $filename 1 (size of $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,
+ 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:
+ if ($tree.type == "FileChunks"):
+ $first_chunk = $tree.1
+ $i = 1
+ $has_use = (no)
+ repeat while ($i <= (size of $first_chunk)):
+ if (($first_chunk.$i.type == "Action") and ($first_chunk.$i.stub == "use")):
+ $has_use = (yes)
+ ..else:
+ if $has_use:
+ go to (insert chunk)
+ $i += 1
+ return
+ --- (insert chunk) ---
+ [$chunk1, $chunk2] = [
+ SyntaxTree {.type = "Block", .source = $first_chunk.source}
+ SyntaxTree {.type = "Block", .source = $first_chunk.source}
+ ]
+
+ for $j in 1 to ($i - 1):
+ $chunk1.$j = $first_chunk.$j
+
+ for $j in $i to (size of $first_chunk):
+ $chunk2.($j - $i + 1) = $first_chunk.$j
+
+ $new_tree =
+ SyntaxTree {.source = $tree.source, .type = "FileChunks"} $chunk1 $chunk2
+
+ for $i in 2 to (size of $tree):
+ $new_tree.($i + 1) = $tree.$i
+
+ return $new_tree