aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.nom12
-rw-r--r--compatibility/compatibility.nom6
-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.nom8
-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.nom22
-rw-r--r--lib/os.nom2
-rw-r--r--lib/training_wheels.nom2
-rw-r--r--lib/version.nom4
-rwxr-xr-xtools/autoformat.nom2
-rwxr-xr-xtools/find_action.nom4
-rwxr-xr-xtools/parse.nom2
-rwxr-xr-xtools/test.nom2
-rwxr-xr-xtools/upgrade.nom2
30 files changed, 52 insertions, 52 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index d428b4c..4e4a022 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 088e320..cf88b13 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 d127294..53a0435 100644
--- a/compatibility/2.5.5.5.nom
+++ b/compatibility/2.5.5.5.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.4
+#!/usr/bin/env nomsu -V3.5.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 128bf6a..a76ab3a 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 53d9988..5d4d0f6 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file defines upgrades from Nomsu 1 to Nomsu 2
diff --git a/compatibility/3.nom b/compatibility/3.nom
index a83621b..408472f 100644
--- a/compatibility/3.nom
+++ b/compatibility/3.nom
@@ -1,11 +1,13 @@
-#!/usr/bin/env nomsu -V3
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file defines upgrades from Nomsu <=2 to Nomsu 3
use "compatibility/compatibility.nom"
upgrade action (method %spec %body) to "3" as (my action %spec %body)
-upgrade action (me) to "3" as (%me)
-upgrade action (@) to "3" as (%me)
-upgrade action (as % %) to "3" via (..)
- [] -> (barf "Object API has changed. Use (%obj::action 1 2) instead of (as %obj: action 1 2)")
+upgrade action (me) to "3" as %me
+upgrade action (@) to "3" as %me
+upgrade action "as 1 2" to "3" via (..)
+ [] -> (..)
+ barf ".."
+ Object API has changed. Use (%obj::action 1 2) instead of (as %obj: action 1 2)
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 982cec6..86a5ac7 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains code for defining ways to upgrade code between different versions
of Nomsu.
@@ -9,10 +9,8 @@ use "lib/os.nom"
action [upgrade to %version via %upgrade_fn]:
%UPGRADES.%version = %upgrade_fn
-%ACTION_UPGRADES = {}
+%ACTION_UPGRADES = ({} with fallback % -> [])
action [upgrade action %stub to %version via %upgrade_fn]:
- unless %ACTION_UPGRADES.%version:
- %ACTION_UPGRADES.%version = []
%ACTION_UPGRADES.%version.%stub = %upgrade_fn
parse [upgrade %tree to %version as %body] as (..)
diff --git a/core/collections.nom b/core/collections.nom
index 8270f62..790fc56 100644
--- a/core/collections.nom
+++ b/core/collections.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 5210519..5bc0811 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 51027a7..ff1b978 100644
--- a/core/coroutines.nom
+++ b/core/coroutines.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file defines the code that creates and manipulates coroutines
diff --git a/core/errors.nom b/core/errors.nom
index d8c23b8..4e87fa5 100644
--- a/core/errors.nom
+++ b/core/errors.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains basic error reporting code
diff --git a/core/io.nom b/core/io.nom
index 7af6822..d5895da 100644
--- a/core/io.nom
+++ b/core/io.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains basic input/output code
diff --git a/core/math.nom b/core/math.nom
index f7e8743..30332dc 100644
--- a/core/math.nom
+++ b/core/math.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file defines some common math literals and functions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 097719c..a8e2f7c 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This File contains actions for making actions and compile-time actions and some helper
functions to make that easier.
@@ -334,8 +334,8 @@ compile [type of %obj] to (Lua value "type(\(%obj as lua expr))")
test:
assume ((parse "foo %") == \(foo \%))
%a = (parse "\\1")
- %b = \\1
- assume ((parse "\\1") == \\1)
+ %b = \(\(1))
+ assume ((parse "\\1") == \(\(1)))
compile [parse %text] to (Lua value "nomsu:parse(\(%text as lua expr))")
compile [parse %text from %filename] to (..)
Lua value ".."
@@ -356,7 +356,7 @@ compile [run %nomsu_code] to (..)
..)
test:
- assume ((\(\5 + \5) as value) == 10) or barf "%tree as value failed."
+ assume ((\(\(5) + \(5)) as value) == 10) or barf "%tree as value failed."
action [run tree %tree, %tree as value] (lua> "return nomsu:run(\%tree)")
compile [compile %block, compiled %block, %block compiled] to (..)
Lua value "nomsu:compile(\(%block as lua))"
diff --git a/core/operators.nom b/core/operators.nom
index 0a46eb5..699663c 100644
--- a/core/operators.nom
+++ b/core/operators.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains definitions of operators like "+" and "and".
diff --git a/core/scopes.nom b/core/scopes.nom
index 8fd569f..101f955 100644
--- a/core/scopes.nom
+++ b/core/scopes.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains definitions pertaining to variable scoping
diff --git a/core/text.nom b/core/text.nom
index a82e9df..00a3c4b 100644
--- a/core/text.nom
+++ b/core/text.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 5979d82..cb2cdda 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
# 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 7f5e2de..8de1ba8 100644
--- a/lib/base64.nom
+++ b/lib/base64.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 dd07647..6ecf40b 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file defines actions for ANSI console color escape codes.
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index 32f6703..b3d1919 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 cad7b89..22321b3 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -1,17 +1,16 @@
-#!/usr/bin/env nomsu -V3
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains the implementation of an Object-Oriented programming system.
test:
object "Dog":
(Dog).genus = "Canus"
- my action [set up]:
- %me.barks or= 0
+ my action [set up]: %me.barks or= 0
my action [bark, woof]:
%barks = ("Bark!" for % in 1 to %me.barks)
return (%barks joined with " ")
- my action [get pissed off]:
- %me.barks += 1
+
+ my action [get pissed off]: %me.barks += 1
%d = (new Dog {barks:2})
assume (%d.barks == 2)
@@ -26,14 +25,14 @@ test:
assume (%d.barks == 3)
%d2 = (new Dog)
assume (%d2.barks == 0) or barf "Default initializer failed"
- with {%d:new Dog {barks:1}}: assume ((%d::bark) == "Bark!")
-
+ with {%d:new Dog {barks:1}}:
+ assume ((%d::bark) == "Bark!")
object "Corgi" extends (Dog):
my action [sploot] "splooted"
my action [bark, woof]:
%barks = ("Yip!" for % in 1 to %me.barks)
return (%barks joined with " ")
-
+
%corg = (new Corgi)
assume (%corg.barks == 0)
with {%d:new Corgi {barks:1}}:
@@ -43,13 +42,14 @@ test:
with {%d:new Dog {barks:2}}:
assume ((%d::bark) == "Bark! Bark!")
-
compile [my action %actions %body] to:
lua> ".."
local fn_name = "A"..string.as_lua_id(\%actions[1].stub)
local \%args = table.map(\%actions[1]:get_args(), function(a) return tostring(nomsu:compile(a)) end)
table.insert(\%args, \(\%me as lua id))
- local lua = LuaCode(tree.source, "class.", fn_name, " = ", \(compile as (%args -> %body)))
+ local lua = LuaCode(tree.source, "class.", fn_name, " = ", \(..)
+ compile as (%args -> %body)
+ ..)
for i=2,#\%actions do
local alias = \%actions[i]
local alias_name = "A"..string.as_lua_id(alias.stub)
@@ -94,7 +94,7 @@ compile [object %classname extends %parent %class_body] to:
end
\(%class_body as lua statements)
-
+
local metamethod_map = {["as text"]="__tostring", ["clean up"]="__gc",
["+ 1"]="__add", ["- 1"]="__sub", ["* 1"]="__mul", ["/ 1"]="__div",
["-"]="__unm", ["// 1"]="__idiv", ["mod 1"]="__mod", ["^ 1"]="__pow",
diff --git a/lib/os.nom b/lib/os.nom
index 03d9657..73db72b 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
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 46ffecd..28b82ce 100644
--- a/lib/training_wheels.nom
+++ b/lib/training_wheels.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "||" and "continue")
diff --git a/lib/version.nom b/lib/version.nom
index a871ac1..9c34e4b 100644
--- a/lib/version.nom
+++ b/lib/version.nom
@@ -1,3 +1,3 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
# This file sets the current library version.
-lua> "NOMSU_LIB_VERSION = 5"
+lua> "NOMSU_LIB_VERSION = 6"
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index c49b6b6..3c9ec60 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 720899b..fa962e4 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
Find an action by its stub. Usage:
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
@@ -8,7 +8,7 @@ use "lib/os.nom"
use "lib/consolecolor.nom"
%stub = (command line args).1
-say "Looking for stub: \%stub (from \(command line args))"
+say "Looking for stub: \%stub..."
%files = ((command line args).% for % in 2 to (|| (command line args) ||))
for %path in %files:
for file %filename in %path:
diff --git a/tools/parse.nom b/tools/parse.nom
index a7297e4..0f47134 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 f94d865..6caea87 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.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 6cc2d2c..e3468b4 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V2.5.5.5
+#!/usr/bin/env nomsu -V3.5.5.6
#
Tool to automatically update code from old versions of Nomsu. Usage:
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...