aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-08-29 15:02:36 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-08-29 15:03:03 -0700
commit23b52bc22d9ec24702c1bed0f8ce90271eec6460 (patch)
treead30c4d7da4fe2f0cb328ea5c0da883ec91ac641
parente64632be1aa938c865d06acfcf6641b75ecb42ac (diff)
Intermediate step in upgrading to 3.6. Fixed a bug with upgrading
methods.
-rw-r--r--code_obj.lua6
-rw-r--r--code_obj.moon7
-rw-r--r--compatibility/2.3.nom2
-rw-r--r--compatibility/2.4.nom2
-rw-r--r--compatibility/2.5.5.5.nom2
-rw-r--r--compatibility/2.5.nom2
-rw-r--r--compatibility/2.nom2
-rw-r--r--compatibility/3.5.5.6.nom9
-rw-r--r--compatibility/3.6.nom21
-rw-r--r--compatibility/3.nom2
-rw-r--r--compatibility/compatibility.nom16
-rw-r--r--core/metaprogramming.nom4
-rw-r--r--nomsu.2.peg2
-rw-r--r--nomsu.3.peg2
-rwxr-xr-xtools/autoformat.nom2
-rwxr-xr-xtools/find_action.nom2
-rwxr-xr-xtools/parse.nom2
-rwxr-xr-xtools/test.nom2
-rwxr-xr-xtools/upgrade.nom2
19 files changed, 64 insertions, 25 deletions
diff --git a/code_obj.lua b/code_obj.lua
index b07c063..c4eb52f 100644
--- a/code_obj.lua
+++ b/code_obj.lua
@@ -505,6 +505,12 @@ do
end
NomsuCode = _class_0
end
+Code.__base.append_1 = Code.__base.append
+Code.__base.append_1_joined_by_2 = Code.__base.concat_append
+Code.__base.prepend_1 = Code.__base.prepend
+Code.__base.declare_locals_1 = Code.__base.declare_locals
+Code.__base.remove_free_vars_1 = Code.__base.remove_free_vars
+Code.__base.add_free_vars_1 = Code.__base.add_free_vars
return {
Code = Code,
NomsuCode = NomsuCode,
diff --git a/code_obj.moon b/code_obj.moon
index 5ed10f3..3962bcc 100644
--- a/code_obj.moon
+++ b/code_obj.moon
@@ -256,4 +256,11 @@ class NomsuCode extends Code
__repr: Code.__repr
__len: Code.__len
+Code.__base.append_1 = Code.__base.append
+Code.__base.append_1_joined_by_2 = Code.__base.concat_append
+Code.__base.prepend_1 = Code.__base.prepend
+Code.__base.declare_locals_1 = Code.__base.declare_locals
+Code.__base.remove_free_vars_1 = Code.__base.remove_free_vars
+Code.__base.add_free_vars_1 = Code.__base.add_free_vars
+
return {:Code, :NomsuCode, :LuaCode, :Source}
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index 4e4a022..5e75ce7 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <2.3 to Nomsu 2.3
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index cf88b13..2207343 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <2.4 to Nomsu 2.4
diff --git a/compatibility/2.5.5.5.nom b/compatibility/2.5.5.5.nom
index 53a0435..cd266da 100644
--- a/compatibility/2.5.5.5.nom
+++ b/compatibility/2.5.5.5.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index a76ab3a..4c67809 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <2.5 to Nomsu 2.5
diff --git a/compatibility/2.nom b/compatibility/2.nom
index 5d4d0f6..1fdfa50 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu 1 to Nomsu 2
diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom
index 32d598c..a8b8a69 100644
--- a/compatibility/3.5.5.6.nom
+++ b/compatibility/3.5.5.6.nom
@@ -1,8 +1,11 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6
use "compatibility/compatibility.nom"
-upgrade action "traceback" to "3.5.5.6" via ([%] -> (barf "'traceback' has been deprecated"))
-upgrade action "traceback 1" to "3.5.5.6" via ([%] -> (barf "'traceback 1' has been deprecated"))
+upgrade action "traceback" to "3.5.5.6" via (..)
+ [%] -> (barf "'traceback' has been deprecated")
+
+upgrade action "traceback 1" to "3.5.5.6" via (..)
+ [%] -> (barf "'traceback 1' has been deprecated")
diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom
new file mode 100644
index 0000000..6697375
--- /dev/null
+++ b/compatibility/3.6.nom
@@ -0,0 +1,21 @@
+#!/usr/bin/env nomsu -V3
+#
+ This file defines upgrades from Nomsu <3.6 to 3.6
+
+use "compatibility/compatibility.nom"
+
+upgrade action (to %1 write %2) to "3.6" as (..)
+ %1::append %2
+upgrade action (%1 <-write %2) to "3.6" as (..)
+ %1::append %2
+upgrade action (to %1 write %2 joined by %3) to "3.6" as (..)
+ %1::append %2 joined by %3
+upgrade action (declare locals in %lua) to "3.6" as (..)
+ %lua::declare locals
+upgrade action (declare locals %locs in %lua) to "3.6" as (..)
+ %lua::declare locals %locs
+upgrade action (add free vars %vars to %lua) to "3.6" as (..)
+ %lua::add free vars %vars
+upgrade action (remove free vars %vars from %lua) to "3.6" as (..)
+ %lua::remove free vars %vars
+
diff --git a/compatibility/3.nom b/compatibility/3.nom
index 408472f..ea33b14 100644
--- a/compatibility/3.nom
+++ b/compatibility/3.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <=2 to Nomsu 3
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 86a5ac7..d74cabe 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains code for defining ways to upgrade code between different versions
of Nomsu.
@@ -33,20 +33,22 @@ compile [upgrade action %actions to %version as %body] to:
return %replacements.(%t.1)
..else:
return ".."
- \(%t.type)(\(quote "\(%t.source)"), \(..)
+ \(%t.type){source=\(quote "\(%t.source)"), \(..)
quote "\(%t.1) \000\(=lua "string.format('%X', __MANGLE_INDEX)")"
- ..)
+ ..}
(%t is syntax tree):
%args = ((make tree %) for % in %t)
- add "\(\%tree as lua id).source" to %args at index 1
- return "\(%t.type)(\(%args joined with ", "))"
+ add "source=\(\%tree as lua id).source" to %args at index 1
+ if %t.target:
+ add "target=\(make tree %t.target)" to %args at index 1
+ return "\(%t.type){\(%args joined with ", ")}"
else:
return (quote "\%t")
- unless ("\%lua" == ""): to %lua write "\n"
- to %lua write (..)
+ unless ("\%lua" == ""): %lua::append "\n"
+ %lua::append (..)
Lua ".."
A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
\%tree as lua id
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 2392097..e141bc0 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -1,9 +1,9 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This File contains actions for making actions and compile-time actions and some helper
functions to make that easier.
-lua> "NOMSU_CORE_VERSION = 5"
+lua> "NOMSU_CORE_VERSION = 6"
lua> ".."
COMPILE_ACTIONS["1 -> 2"] = function(nomsu, tree, \%args, \%body)
local lua = LuaCode.Value(tree.source, "(function(")
diff --git a/nomsu.2.peg b/nomsu.2.peg
index ce4d2d7..4f9c4c4 100644
--- a/nomsu.2.peg
+++ b/nomsu.2.peg
@@ -5,7 +5,7 @@ file:
/ file_chunks / empty_block)
%ws* (!! .+ -> "Parse error" !!)?
-shebang: {:shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^%nl]* :}
+shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^%nl]*
file_chunks (FileChunks):
{:curr_indent: ' '* :}
diff --git a/nomsu.3.peg b/nomsu.3.peg
index 225ccac..244a621 100644
--- a/nomsu.3.peg
+++ b/nomsu.3.peg
@@ -5,7 +5,7 @@ file:
/ file_chunks / empty_block)
%ws* (!! .+ -> "Parse error" !!)?
-shebang: {:shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^%nl]* :}
+shebang: "#!" (!"nomsu" [^%nl])* "nomsu" %ws+ "-V" %ws* {:version: [0-9.]+ :} [^%nl]*
file_chunks (FileChunks):
{:curr_indent: ' '* :}
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index 3c9ec60..6c4420a 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
Auto-format Nomsu code. Usage:
nomsu tools/autoformat.nom [-i] file1 file2 directory1 ...
diff --git a/tools/find_action.nom b/tools/find_action.nom
index fa962e4..051899a 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
Find an action by its stub. Usage:
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
diff --git a/tools/parse.nom b/tools/parse.nom
index 0f47134..ef081a7 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
Tool to print out a parse tree of files in an easy-to-read format. Usage:
nomsu tools/parse.nom file1 file2 directory1 ...
diff --git a/tools/test.nom b/tools/test.nom
index 6caea87..7a1ee1e 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
Tool to run all tests in a file (i.e. the code block inside a call to 'test %'). Usage:
nomsu tools/test.nom file1 file2 directory1 ...
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index e3468b4..c74b8e7 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...