aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-30 19:39:32 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-30 19:39:32 -0700
commitc6a7b0be9ebdddb58a03749705987cb3058060d3 (patch)
treebb98639f13e9589b161c0c09ae269621e2addbee
parent56143adf979ae3e425c783ac1a6f1be3e7b58f82 (diff)
Added compatibility for 2.5.5.5 (file hash changes).
-rw-r--r--compatibility/2.3.nom2
-rw-r--r--compatibility/2.4.nom2
-rw-r--r--compatibility/2.5.5.5.nom14
-rw-r--r--compatibility/2.5.nom2
-rw-r--r--compatibility/2.nom2
-rw-r--r--compatibility/compatibility.nom73
-rw-r--r--core/collections.nom2
-rw-r--r--core/control_flow.nom2
-rw-r--r--core/coroutines.nom2
-rw-r--r--core/errors.nom2
-rw-r--r--core/io.nom2
-rw-r--r--core/math.nom2
-rw-r--r--core/metaprogramming.nom2
-rw-r--r--core/operators.nom2
-rw-r--r--core/scopes.nom2
-rw-r--r--core/text.nom2
-rw-r--r--examples/how_do_i.nom2
-rw-r--r--lib/base64.nom2
-rw-r--r--lib/consolecolor.nom2
-rw-r--r--lib/file_hash.nom2
-rw-r--r--lib/object.nom2
-rw-r--r--lib/os.nom2
-rw-r--r--lib/training_wheels.nom4
-rw-r--r--lib/version.nom2
-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
29 files changed, 82 insertions, 61 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index 0127d15..d428b4c 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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 3037078..2c5cc8e 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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
new file mode 100644
index 0000000..d127294
--- /dev/null
+++ b/compatibility/2.5.5.5.nom
@@ -0,0 +1,14 @@
+#!/usr/bin/env nomsu -V2.5.5.4
+#
+ This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5
+
+use "compatibility/compatibility.nom"
+
+upgrade action [hash %, sha1 %] to "2.5.5.5" as (..)
+ =lua ".."
+ \(base64 decode (hash %)):gsub('.', function(c) return ('%x02'):format(c) end)
+
+upgrade action [file with hash %] to "2.5.5.5" as (..)
+ file with hash (..)
+ base64 (..)
+ =lua "\%:gsub('..', function(xx) return string.char(tonumber(xx, 16)) end)"
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index b9574f4..128bf6a 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines upgrades from Nomsu <2.5 to Nomsu 2.5
diff --git a/compatibility/2.nom b/compatibility/2.nom
index c16f73c..399d485 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines upgrades from Nomsu 1 to Nomsu 2
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 61818d6..982cec6 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains code for defining ways to upgrade code between different versions
of Nomsu.
@@ -18,39 +18,46 @@ action [upgrade action %stub to %version via %upgrade_fn]:
parse [upgrade %tree to %version as %body] as (..)
upgrade to %version via ([%] -> (% with %tree -> %body))
-compile [upgrade action %action to %version as %body] to:
- %replacements = {}
- for %i in 1 to (length of %action):
- if (%action.%i.type is "Var"):
- %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]"
-
- local action [make tree %t]:
- when:
- (%t is "Var" syntax tree):
- if %replacements.(%t.1):
- return %replacements.(%t.1)
- ..else:
- return ".."
- \(%t.type)(\(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 ", "))"
-
- else:
- return (quote "\%t")
+compile [upgrade action %actions to %version as %body] to:
+ if (%actions is "Action" syntax tree):
+ %actions = [%actions]
+ %lua = (Lua "")
+ for %action in %actions:
+ %replacements = {}
+ for %i in 1 to (length of %action):
+ if (%action.%i.type is "Var"):
+ %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]"
+
+ local action [make tree %t]:
+ when:
+ (%t is "Var" syntax tree):
+ if %replacements.(%t.1):
+ return %replacements.(%t.1)
+ ..else:
+ return ".."
+ \(%t.type)(\(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 ", "))"
+
+ else:
+ return (quote "\%t")
+
+ unless ("\%lua" == ""): to %lua write "\n"
+ to %lua write (..)
+ Lua ".."
+ A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
+ \%tree as lua id
+ ..)
+ __MANGLE_INDEX = (__MANGLE_INDEX or 0) + 1
+ return \(make tree %body)
+ end)
- return (..)
- Lua ".."
- A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
- \%tree as lua id
- ..)
- __MANGLE_INDEX = (__MANGLE_INDEX or 0) + 1
- return \(make tree %body)
- end)
+ return %lua
action [..]
%tree upgraded from %start_version to %end_version
diff --git a/core/collections.nom b/core/collections.nom
index 99c84ca..8553d66 100644
--- a/core/collections.nom
+++ b/core/collections.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains code that supports manipulating and using collections like lists
and dictionaries.
diff --git a/core/control_flow.nom b/core/control_flow.nom
index 0552771..703c438 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains compile-time actions that define basic control flow structures
like "if" statements and loops.
diff --git a/core/coroutines.nom b/core/coroutines.nom
index 1cc5a71..51027a7 100644
--- a/core/coroutines.nom
+++ b/core/coroutines.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines the code that creates and manipulates coroutines
diff --git a/core/errors.nom b/core/errors.nom
index 6b1ddae..d8c23b8 100644
--- a/core/errors.nom
+++ b/core/errors.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains basic error reporting code
diff --git a/core/io.nom b/core/io.nom
index 651eee2..7af6822 100644
--- a/core/io.nom
+++ b/core/io.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains basic input/output code
diff --git a/core/math.nom b/core/math.nom
index 3fad8f0..f7e8743 100644
--- a/core/math.nom
+++ b/core/math.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines some common math literals and functions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 9acc97e..153a0bf 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This File contains actions for making actions and compile-time actions and some helper
functions to make that easier.
diff --git a/core/operators.nom b/core/operators.nom
index e3c71b0..b6e0963 100644
--- a/core/operators.nom
+++ b/core/operators.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains definitions of operators like "+" and "and".
diff --git a/core/scopes.nom b/core/scopes.nom
index 3456bc0..8fd569f 100644
--- a/core/scopes.nom
+++ b/core/scopes.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains definitions pertaining to variable scoping
diff --git a/core/text.nom b/core/text.nom
index 395012f..701b1cd 100644
--- a/core/text.nom
+++ b/core/text.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains some definitions of text escape sequences, including ANSI console
color codes.
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom
index b85d496..5979d82 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
# How do I...
# Write a comment? Put a # and go till the end of the line
# How do I write a multi-line comment?
diff --git a/lib/base64.nom b/lib/base64.nom
index a65a99d..7f5e2de 100644
--- a/lib/base64.nom
+++ b/lib/base64.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines actions for encoding/decoding base 64, as specified in:
https://tools.ietf.org/html/rfc4648
diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom
index 1fdf4b2..dd07647 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines actions for ANSI console color escape codes.
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index 2f9076e..32f6703 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines some actions for hashing files and looking up files by hash.
diff --git a/lib/object.nom b/lib/object.nom
index 8c33f36..dd99109 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains the implementation of an Object-Oriented programming system.
diff --git a/lib/os.nom b/lib/os.nom
index a7df0a9..8bbc7c5 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file defines some actions that interact with the operating system and filesystem.
diff --git a/lib/training_wheels.nom b/lib/training_wheels.nom
index 253f601..46ffecd 100644
--- a/lib/training_wheels.nom
+++ b/lib/training_wheels.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "||" and "continue")
@@ -15,7 +15,7 @@ parse [%a || %b] as (%a or %b)
parse [%a && %b] as (%a and %b)
parse [continue] as (do next)
parse [break] as (stop)
-parse [let %thing = %value in %action] as (with local {%thing: %value})
+parse [let %thing = %value in %action] as (with local {%thing:%value})
parse [print %, println %] as (say %)
parse [error!, panic!, fail!, abort!] as (barf!)
parse [error %, panic %, fail %, abort %] as (barf %)
diff --git a/lib/version.nom b/lib/version.nom
index 1e4389e..a871ac1 100644
--- a/lib/version.nom
+++ b/lib/version.nom
@@ -1,3 +1,3 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
# This file sets the current library version.
lua> "NOMSU_LIB_VERSION = 5"
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index 3d4ce31..c49b6b6 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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 8c6a453..2ddc89f 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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 42911d6..a7297e4 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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 bd51e10..f94d865 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
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 88f34fc..490a58e 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V2.5.5.5
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...