aboutsummaryrefslogtreecommitdiff
path: root/lib/compatibility
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-18 14:22:17 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-18 14:22:48 -0800
commit10bd72e858a8ffaacafa296dbbc429dc73b0111c (patch)
tree3dec18257ac6d1affe78aa33a9b389a25eda1256 /lib/compatibility
parent520acd39795766354fc44c6e15f5f33f255ca33a (diff)
Added `tree` back as a parameter to compile actions, which helps with
better error reporting, e.g. for (fail) (no arguments). Overall better error reporting now. Also added shorthand ("Action" tree with ...) for (SyntaxTree {.type = "Action", .1 = ...}).
Diffstat (limited to 'lib/compatibility')
-rw-r--r--lib/compatibility/4.10.12.7.nom9
-rw-r--r--lib/compatibility/4.11.nom2
-rw-r--r--lib/compatibility/6.14.nom4
-rw-r--r--lib/compatibility/compatibility.nom2
4 files changed, 7 insertions, 10 deletions
diff --git a/lib/compatibility/4.10.12.7.nom b/lib/compatibility/4.10.12.7.nom
index eeff2f2..be53cb6 100644
--- a/lib/compatibility/4.10.12.7.nom
+++ b/lib/compatibility/4.10.12.7.nom
@@ -63,10 +63,8 @@ upgrade $tree to "4.10.12.7" as:
$i += 1
return
--- (insert chunk) ---
- [$chunk1, $chunk2] = [
- SyntaxTree {.type = "Block", .source = $first_chunk.source}
- SyntaxTree {.type = "Block", .source = $first_chunk.source}
- ]
+ [$chunk1, $chunk2] =
+ ["Block" tree from $first_chunk.source, "Block" tree from $first_chunk.source]
for $j in 1 to ($i - 1):
$chunk1.$j = $first_chunk.$j
@@ -74,8 +72,7 @@ upgrade $tree to "4.10.12.7" as:
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
+ $new_tree = ("FileChunks" tree from $tree.source with $chunk1 $chunk2)
for $i in 2 to (size of $tree):
$new_tree.($i + 1) = $tree.$i
diff --git a/lib/compatibility/4.11.nom b/lib/compatibility/4.11.nom
index 053e1c8..e30734d 100644
--- a/lib/compatibility/4.11.nom
+++ b/lib/compatibility/4.11.nom
@@ -25,7 +25,7 @@ upgrade action "set" to "4.11" via
for $entry in $tree.2 at $i:
$lhs.$i = $entry.1
$rhs.$i = $entry.2
- return (SyntaxTree {.type = "Action", .source = $tree.source} $lhs "=" $rhs)
+ return ("Action" tree from $tree.source with $lhs "=" $rhs)
upgrade action "1 with 2 ~>" to "4.11" via
for $tree:
diff --git a/lib/compatibility/6.14.nom b/lib/compatibility/6.14.nom
index 0e742d0..b11474b 100644
--- a/lib/compatibility/6.14.nom
+++ b/lib/compatibility/6.14.nom
@@ -28,11 +28,11 @@ upgrade action (assume $assumption or barf $err) to "6.14" as
upgrade action (barf $msg) to "6.14" as (fail $msg)
upgrade action (\(1's meaning)).stub to "6.14" via
- $tree -> (SyntaxTree {.source = $tree.source, .type = "Var", $tree.1})
+ $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
for $tree:
$path = $tree.2.1
$path = ($path, with "%.nom$" -> "")
$path = ($path, with "^lib/" -> "")
- return \(use (SyntaxTree {.source = $tree.2.source, .type = "Text"} $path))
+ return \(use ("Text" tree from $tree.2.source with $path))
diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom
index 419f589..45ea1d6 100644
--- a/lib/compatibility/compatibility.nom
+++ b/lib/compatibility/compatibility.nom
@@ -43,7 +43,7 @@ external:
($t is syntax tree):
$args = []
for $k = $v in $t:
- if ((type of $k) == "number"):
+ if ((type of $k) == "a number"):
$args, add (make tree $v)
..else:
$args, add "\($k)=\(make tree $v)"