aboutsummaryrefslogtreecommitdiff
path: root/compatibility/2.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-12-30 19:04:34 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-12-30 19:04:45 -0800
commit8a3c32408733a2f5e14f8a2dbafa3f980b2f73a1 (patch)
tree68f1e8a8b956c33ed24cc7a6a369fd97b8849321 /compatibility/2.nom
parent359152da1772ce501609edd8f84b4985ed3e42f2 (diff)
Update to new syntax.
Diffstat (limited to 'compatibility/2.nom')
-rw-r--r--compatibility/2.nom18
1 files changed, 10 insertions, 8 deletions
diff --git a/compatibility/2.nom b/compatibility/2.nom
index 03e2db7..b4b0efd 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V5.12.12.8
+#!/usr/bin/env nomsu -V6.12.12.8
#
This file defines upgrades from Nomsu 1 to Nomsu 2
@@ -16,21 +16,23 @@ upgrade $tree to "2" as:
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
+ return
+ \(if $cond $true_body else $false_body) with vars {
+ .cond = ($tree.2 upgraded), .true_body = $true_body, .false_body = $false_body
+ }
- $need_blocks = [..]
+ $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) = (..)
+ 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)}")