aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compatibility/4.10.12.7.nom3
-rw-r--r--compatibility/4.11.nom3
-rw-r--r--compatibility/6.14.nom8
-rw-r--r--compatibility/init.nom2
-rw-r--r--lib/core/init.nom1
-rw-r--r--lib/core/operators.nom2
-rw-r--r--syntax_tree.lua5
-rw-r--r--syntax_tree.moon4
8 files changed, 20 insertions, 8 deletions
diff --git a/compatibility/4.10.12.7.nom b/compatibility/4.10.12.7.nom
index e88b5be..c241898 100644
--- a/compatibility/4.10.12.7.nom
+++ b/compatibility/4.10.12.7.nom
@@ -77,8 +77,7 @@ upgrade $tree to "4.10.12.7" as:
$chunk2.($j - $i + 1) = $first_chunk.$j
$new_tree =
- SyntaxTree
- {.source = $tree.source, .type = "FileChunks", .1 = $chunk1, .2 = $chunk2}
+ SyntaxTree {.source = $tree.source, .type = "FileChunks"} $chunk1 $chunk2
for $i in 2 to (size of $tree):
$new_tree.($i + 1) = $tree.$i
diff --git a/compatibility/4.11.nom b/compatibility/4.11.nom
index 7864bc2..24dbbdc 100644
--- a/compatibility/4.11.nom
+++ b/compatibility/4.11.nom
@@ -27,8 +27,7 @@ upgrade action "set" to "4.11" via
$rhs.$i = $entry.2
return
- SyntaxTree
- {.type = "Action", .source = $tree.source, .1 = $lhs, .2 = "=", .3 = $rhs}
+ SyntaxTree {.type = "Action", .source = $tree.source} $lhs "=" $rhs
upgrade action "1 with 2 ~>" to "4.11" via
for $tree:
diff --git a/compatibility/6.14.nom b/compatibility/6.14.nom
index affdabf..8443157 100644
--- a/compatibility/6.14.nom
+++ b/compatibility/6.14.nom
@@ -31,3 +31,11 @@ upgrade action (\(1's meaning)).stub to "6.14" via
$tree -> (SyntaxTree {.source = $tree.source, .type = "Var", $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))
+
diff --git a/compatibility/init.nom b/compatibility/init.nom
index 056428f..40cafff 100644
--- a/compatibility/init.nom
+++ b/compatibility/init.nom
@@ -1,4 +1,4 @@
-
+#!/usr/bin/env nomsu -V6.14.13.8
export "compatibility/compatibility"
export "compatibility/2"
export "compatibility/2.3"
diff --git a/lib/core/init.nom b/lib/core/init.nom
index 0c8051d..5b1074f 100644
--- a/lib/core/init.nom
+++ b/lib/core/init.nom
@@ -1,3 +1,4 @@
+#!/usr/bin/env nomsu -V6.14.13.8
# Export everything
export "core/metaprogramming"
export "core/operators"
diff --git a/lib/core/operators.nom b/lib/core/operators.nom
index dee76b6..912b7c1 100644
--- a/lib/core/operators.nom
+++ b/lib/core/operators.nom
@@ -85,7 +85,7 @@ test:
set global x local y
unless (($foozle == "inner") and ($y == "outer")): fail "external failed."
(external $var = $value) compiles to:
- $lua = ((SyntaxTree {.type = "Action", .source = $var.source, .1 = $var, .2 = "=", .3 = $value}) as lua)
+ $lua = ((SyntaxTree {.type = "Action", .source = $var.source} $var "=" $value) as lua)
$lua, remove free vars
return $lua
test:
diff --git a/syntax_tree.lua b/syntax_tree.lua
index 9886753..017b44a 100644
--- a/syntax_tree.lua
+++ b/syntax_tree.lua
@@ -225,11 +225,14 @@ do
SyntaxTree = _class_0
end
SyntaxTree.__base.__type = "Syntax Tree"
-getmetatable(SyntaxTree).__call = function(self, t)
+getmetatable(SyntaxTree).__call = function(self, t, ...)
if type(t.source) == 'string' then
t.source = Source:from_string(t.source)
end
setmetatable(t, self.__base)
+ for i = 1, select("#", ...) do
+ t[i] = select(i, ...)
+ end
if t.type == 'Action' then
t.stub = t:get_stub()
end
diff --git a/syntax_tree.moon b/syntax_tree.moon
index b59f1ef..6347be8 100644
--- a/syntax_tree.moon
+++ b/syntax_tree.moon
@@ -111,10 +111,12 @@ class SyntaxTree
SyntaxTree.__base.__type = "Syntax Tree"
-getmetatable(SyntaxTree).__call = (t)=>
+getmetatable(SyntaxTree).__call = (t, ...)=>
if type(t.source) == 'string'
t.source = Source\from_string(t.source)
setmetatable(t, @__base)
+ for i=1,select("#", ...)
+ t[i] = select(i, ...)
if t.type == 'Action'
t.stub = t\get_stub!
return t