aboutsummaryrefslogtreecommitdiff
path: root/compatibility/2.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 /compatibility/2.nom
parent9fceff7e785bb234971b443809eef3da9051c598 (diff)
Moved compatibility to lib/ and fixed path searching for .peg files.
Diffstat (limited to 'compatibility/2.nom')
-rw-r--r--compatibility/2.nom38
1 files changed, 0 insertions, 38 deletions
diff --git a/compatibility/2.nom b/compatibility/2.nom
deleted file mode 100644
index caf7a86..0000000
--- a/compatibility/2.nom
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env nomsu -V6.14
-#
- This file defines upgrades from Nomsu 1 to Nomsu 2
-
-use "compatibility/compatibility"
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-upgrade $tree to "2" as:
- unless ($tree is "Action" syntax tree): return
- if ($tree.stub is "if 1 2 else"):
- $true_body = ($tree.3 upgraded)
- unless ($true_body is "Block" syntax tree):
- $true_body = \(: $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
- }
-
- $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 $n in $need_blocks:
- if ($tree.stub is $n):
- $bits = [: for $ in $tree: add (($ upgraded) if ($ is syntax tree) else $)]
- unless (($bits, last) is "Block" syntax tree):
- $body = ($bits, last)
- $bits.(size of $bits) =
- =lua "SyntaxTree{type='Block', source=\$body.source, \$body}"
- return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}")