aboutsummaryrefslogtreecommitdiff
path: root/lib/compatibility
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-03-20 16:41:44 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-03-20 16:41:44 -0700
commit56e3a0c48ca2b641f77f7e73cce94dc3b133e142 (patch)
tree8efd996580e3bcd7845b39a0f7efe7bc0818a793 /lib/compatibility
parentb44afbf417d602b7f018cd4d24ff07c2bc6d8b6e (diff)
Restoring `(foo) syntax to \(foo)
Diffstat (limited to 'lib/compatibility')
-rw-r--r--lib/compatibility/2.4.nom15
-rw-r--r--lib/compatibility/2.nom6
-rw-r--r--lib/compatibility/4.11.nom5
-rw-r--r--lib/compatibility/4.8.10.nom29
-rw-r--r--lib/compatibility/4.9.nom3
-rw-r--r--lib/compatibility/5.13.nom8
-rw-r--r--lib/compatibility/6.14.nom5
-rw-r--r--lib/compatibility/7.nom3
-rw-r--r--lib/compatibility/compatibility.nom9
9 files changed, 36 insertions, 47 deletions
diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom
index b28893a..480257a 100644
--- a/lib/compatibility/2.4.nom
+++ b/lib/compatibility/2.4.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu <2.4 to Nomsu 2.4
@@ -30,7 +29,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add (else `$line.3)
+ $new_lines, add (else \$line.3)
else:
$conditions, add $line.2
@@ -44,7 +43,7 @@ upgrade $tree to "2.4" as:
")
$conditions = []
- return `(when `("Block" tree from $tree.2.source with (unpack $new_lines)))
+ return \(when \("Block" tree from $tree.2.source with (unpack $new_lines)))
"if 1 is ?" "if 1 = ?":
$values = []
@@ -64,7 +63,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add (else `$line.3)
+ $new_lines, add (else \$line.3)
else:
$values, add $line.2
@@ -77,7 +76,7 @@ upgrade $tree to "2.4" as:
$values = []
return
- `(
- if `($tree.2 upgraded) is
- `("Block" tree from $tree.5.source with (unpack $new_lines))
- )
+ \(
+ if \($tree.2 upgraded) is
+ \("Block" tree from $tree.5.source with (unpack $new_lines))
+ ) \ No newline at end of file
diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom
index 4dc867d..69f2d41 100644
--- a/lib/compatibility/2.nom
+++ b/lib/compatibility/2.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu 1 to Nomsu 2
@@ -16,8 +15,7 @@ upgrade $tree to "2" as:
$false_body = ($tree.5 upgraded)
unless ($false_body is "Block" syntax tree):
$false_body = (=lua "Block(\$false_body.source, \$false_body)")
-
- return `(if `($tree.2 upgraded) `$true_body else `$false_body)
+ return \(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"
@@ -32,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/4.11.nom b/lib/compatibility/4.11.nom
index e91f034..d5a158b 100644
--- a/lib/compatibility/4.11.nom
+++ b/lib/compatibility/4.11.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)
@@ -20,7 +19,7 @@ upgrade action ->$yield_value to "4.11" as (yield $yield_value)
### 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 ($i = $entry) in $tree.2:
@@ -96,4 +95,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.8.10.nom b/lib/compatibility/4.8.10.nom
index ee60a61..5723b0d 100644
--- a/lib/compatibility/4.8.10.nom
+++ b/lib/compatibility/4.8.10.nom
@@ -1,5 +1,4 @@
#!/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"
@@ -13,12 +12,12 @@ upgrade action "local action" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return `(`$spec.1 means `$body)
+ return \(\$spec.1 means \$body)
..else:
- return `(`$spec all mean `$body)
+ return \(\$spec all mean \$body)
else:
- return `(`$spec means `$body)
+ return \(\$spec means \$body)
upgrade action "action" to "4.8.10" via
for ($tree $end_version):
@@ -28,14 +27,14 @@ upgrade action "action" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return `(externally `$spec.1 means `$body)
+ return \(externally \$spec.1 means \$body)
..else:
- return `(externally `$spec all mean `$body)
+ return \(externally \$spec all mean \$body)
else:
- return `(externally `$spec means `$body)
+ return \(externally \$spec means \$body)
..else:
- return `((`$spec)'s meaning)
+ return \((\$spec)'s meaning)
upgrade action "compile 1 to" to "4.8.10" via
for ($tree $end_version):
@@ -44,12 +43,12 @@ upgrade action "compile 1 to" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return `(`$spec.1 compiles to `$body)
+ return \(\$spec.1 compiles to \$body)
..else:
- return `(`$spec all compile to `$body)
+ return \(\$spec all compile to \$body)
else:
- return `(`$spec compiles to `$body)
+ return \(\$spec compiles to \$body)
upgrade action "parse 1 as" to "4.8.10" via
for ($tree $end_version):
@@ -58,12 +57,12 @@ upgrade action "parse 1 as" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return `(`$spec.1 parses as `$body)
+ return \(\$spec.1 parses as \$body)
..else:
- return `(`$spec all parse as `$body)
+ return \(\$spec all parse as \$body)
else:
- return `(`$spec parse as `$body)
+ 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 ddb6b9f..0ec8bc8 100644
--- a/lib/compatibility/4.9.nom
+++ b/lib/compatibility/4.9.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu <4.9 to 4.9
use "compatibility/compatibility"
@@ -10,4 +9,4 @@ upgrade action "if" to "4.9" via
for ($tree $end_version):
if (#$tree > 2):
return $tree
- return `(when `$tree.2)
+ return \(when \$tree.2) \ No newline at end of file
diff --git a/lib/compatibility/5.13.nom b/lib/compatibility/5.13.nom
index 3073fdf..b3d9846 100644
--- a/lib/compatibility/5.13.nom
+++ b/lib/compatibility/5.13.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu <5.13 to 5.13
use "compatibility/compatibility"
@@ -12,11 +11,10 @@ upgrade action "with" to "5.13" via
$assignments = $tree.2
$body = $tree.3
if ($assignments.type != "Dict"): return $tree
- $new_assignments = `[]
+ $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)
+ (all of [$a.type == "DictEntry", #$a == 2]): $a = \(\$a.1 = \$a.2)
$new_assignments.$i = $a
- return `(with `$new_assignments `$body)
+ return \(with \$new_assignments \$body) \ No newline at end of file
diff --git a/lib/compatibility/6.14.nom b/lib/compatibility/6.14.nom
index 0d6b8de..75bbc3f 100644
--- a/lib/compatibility/6.14.nom
+++ b/lib/compatibility/6.14.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu <6.14 to 6.14
@@ -28,7 +27,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 (\(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
@@ -36,4 +35,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 \(use \("Text" tree from $tree.2.source with $path)) \ No newline at end of file
diff --git a/lib/compatibility/7.nom b/lib/compatibility/7.nom
index c84be0c..7300dc3 100644
--- a/lib/compatibility/7.nom
+++ b/lib/compatibility/7.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file defines upgrades from Nomsu <7 to 7
@@ -45,7 +44,7 @@ upgrade $tree to "7" as:
return $t
-upgrade action "Nomsu version" to "7" via ->(`$(NOMSU VERSION))
+upgrade action "Nomsu version" to "7" via ->(\$(NOMSU VERSION))
upgrade action [
"Nomsu syntax version", "Nomsu compiler version", "core version", "lib version"
] to "7" via
diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom
index 83eb3cd..4715282 100644
--- a/lib/compatibility/compatibility.nom
+++ b/lib/compatibility/compatibility.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V7.0.0
-
###
This file contains code for defining ways to upgrade code between different versions
of Nomsu.
@@ -22,13 +21,13 @@ external:
(upgrade action $actions to $version as $body) compiles to:
if ($actions is "Action" syntax tree):
- $actions = `[`$actions]
+ $actions = \[\$actions]
$lua = (Lua "")
for $action in $actions:
$replacements = {}
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:
@@ -60,7 +59,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)
")
@@ -139,4 +138,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