From 18126da9c538046a93715d829722c818773b9ac1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 30 Aug 2018 14:16:09 -0700 Subject: [PATCH] Auto-upgraded to 3.7 --- compatibility/2.3.nom | 2 +- compatibility/2.4.nom | 2 +- compatibility/2.5.5.5.nom | 2 +- compatibility/2.5.nom | 2 +- compatibility/2.nom | 8 ++++---- compatibility/3.5.5.6.nom | 2 +- compatibility/3.6.nom | 2 +- compatibility/3.7.nom | 10 ++++++---- compatibility/3.nom | 2 +- compatibility/compatibility.nom | 8 ++++---- core/collections.nom | 8 +++++--- core/control_flow.nom | 32 ++++++++++++++++---------------- core/coroutines.nom | 2 +- core/errors.nom | 2 +- core/io.nom | 2 +- core/math.nom | 2 +- core/metaprogramming.nom | 2 +- core/operators.nom | 4 ++-- core/scopes.nom | 2 +- core/text.nom | 2 +- examples/how_do_i.nom | 4 ++-- lib/base64.nom | 11 ++++++----- lib/consolecolor.nom | 2 +- lib/file_hash.nom | 10 ++++++---- lib/object.nom | 2 +- lib/os.nom | 2 +- lib/training_wheels.nom | 2 +- lib/version.nom | 2 +- syntax_tree.lua | 3 +-- syntax_tree.moon | 2 +- tools/autoformat.nom | 2 +- tools/find_action.nom | 4 ++-- tools/parse.nom | 5 +++-- tools/replace.nom | 4 ++-- tools/test.nom | 2 +- tools/upgrade.nom | 2 +- 36 files changed, 82 insertions(+), 75 deletions(-) diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom index 5e75ce7..4df7850 100644 --- a/compatibility/2.3.nom +++ b/compatibility/2.3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 4b416fb..741b7eb 100644 --- a/compatibility/2.4.nom +++ b/compatibility/2.4.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 cd266da..b086a9d 100644 --- a/compatibility/2.5.5.5.nom +++ b/compatibility/2.5.5.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 4c67809..27473e7 100644 --- a/compatibility/2.5.nom +++ b/compatibility/2.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 1fdfa50..06e3bff 100644 --- a/compatibility/2.nom +++ b/compatibility/2.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines upgrades from Nomsu 1 to Nomsu 2 @@ -26,8 +26,8 @@ upgrade %tree to "2" as: for %n in %need_blocks: if (%tree.stub is %n): %bits = (((% upgraded) if (% is syntax tree) else %) for % in %tree) - unless ((last in %bits) is "Block" syntax tree): - %body = (last in %bits) - %bits.(length of %bits) = (=lua "Block(\%body.source, \%body)") + unless ((%bits::last) is "Block" syntax tree): + %body = (%bits::last) + %bits.(size of %bits) = (=lua "Block(\%body.source, \%body)") return (=lua "Action(\%tree.source, unpack(\%bits))") diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom index a8b8a69..892725f 100644 --- a/compatibility/3.5.5.6.nom +++ b/compatibility/3.5.5.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6 diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom index e813f7b..c6afc75 100644 --- a/compatibility/3.6.nom +++ b/compatibility/3.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.7 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines upgrades from Nomsu <3.6 to 3.6 diff --git a/compatibility/3.7.nom b/compatibility/3.7.nom index 6472a50..dda2b5a 100644 --- a/compatibility/3.7.nom +++ b/compatibility/3.7.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.7 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines upgrades from Nomsu <3.7 to 3.7 @@ -10,15 +10,17 @@ upgrade action [%index rd to last in %list] to "3.7" as (%list::%index rd to las upgrade action [%index th to last in %list] to "3.7" as (%list::%index rd th last) upgrade action [last in %list] to "3.7" as (%list::last) upgrade action [first in %list] to "3.7" as (%list::first) -upgrade action [%item is in %list, %list contains %item, %list has %item] to "3.7" as (..) - %list::has %item +upgrade action [%item is in %list, %list contains %item, %list has %item] +..to "3.7" as (%list::has %item) upgrade action [..] %item isn't in %list, %item is not in %list, %list doesn't contain %item %list does not contain %item, %list doesn't have %item, %list does not have %item ..to "3.7" as (not (%list::has %item)) -upgrade action [%list has key %index, %list has index %index] to "3.7" as (%list.%index != (nil)) +upgrade action [%list has key %index, %list has index %index] to "3.7" as (..) + %list.%index != (nil) + upgrade action [..] %list doesn't have key %index, %list does not have key %index %list doesn't have index %index, %list does not have index %index diff --git a/compatibility/3.nom b/compatibility/3.nom index ea33b14..d1599cc 100644 --- a/compatibility/3.nom +++ b/compatibility/3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines upgrades from Nomsu <=2 to Nomsu 3 diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index f9f006c..b775172 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.7 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains code for defining ways to upgrade code between different versions of Nomsu. @@ -45,11 +45,11 @@ compile [upgrade action %actions to %version as %body] to: if ((type of %k) == "number"): %args::add (make tree %v) ..else: - %args::add "\%k=\(make tree %v)" + %args::add "\(%k)=\(make tree %v)" + return "\(%t.type){\(%args joined with ", ")}" - else: - return (quote %t) + else: return (quote %t) unless ("\%lua" == ""): %lua::append "\n" %retval = (make tree %body) diff --git a/core/collections.nom b/core/collections.nom index 938466d..9c7e8d0 100644 --- a/core/collections.nom +++ b/core/collections.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains code that supports manipulating and using collections like lists and dictionaries. @@ -11,10 +11,12 @@ use "core/operators.nom" test: %list = [1, 2, 3, 4, 5] %visited = {} - for %i = %x in %list: %visited.%i = (yes) + for %i = %x in %list: + %visited.%i = (yes) assume (%visited == {1:yes, 2:yes, 3:yes, 4:yes, 5:yes}) %visited = {} - for %x in %list: %visited.%x = (yes) + for %x in %list: + %visited.%x = (yes) assume (%visited == {1:yes, 2:yes, 3:yes, 4:yes, 5:yes}) assume ((%list::2 nd to last) == 4) assume ((%list::first) == 1) diff --git a/core/control_flow.nom b/core/control_flow.nom index 63601f7..a786f44 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains compile-time actions that define basic control flow structures like "if" statements and loops. @@ -300,7 +300,7 @@ compile [..] %stop_labels::append "\n\(compile as (===stop %key ===))" if (%body has subtree \(stop %value)): %stop_labels::append "\n\(compile as (===stop %value ===))" - if ((length of "\%stop_labels") > 0): + if ((size of "\%stop_labels") > 0): %lua = (..) Lua ".." do -- scope for stopping for % = % loop @@ -332,18 +332,18 @@ compile [if %body, when %body] to: compile error at %body.source "'if' expected a Block, but got: %s" for %line in %body: unless (..) - ((%line.type is "Action") and ((length of %line) >= 2)) and (..) - %line.(length of %line) is "Block" syntax tree + ((%line.type is "Action") and ((size of %line) >= 2)) and (..) + %line.(size of %line) is "Block" syntax tree ..: compile error at %line.source ".." Invalid line for 'if', each line should contain conditional expressions followed by a block, or "else" followed by a block: %s - %action = %line.(length of %line) - if ((%line.1 is "else") and ((length of %line) == 2)): + %action = %line.(size of %line) + if ((%line.1 is "else") and ((size of %line) == 2)): unless %else_allowed: compile error at %line.source "Can't have two 'else' blocks" - unless ((length of "\%code") > 0): + unless ((size of "\%code") > 0): compile error at %line.source ".." Can't have an 'else' block without a preceeding condition @@ -355,7 +355,7 @@ compile [if %body, when %body] to: %else_allowed = (no) ..else: %code::append "\%clause " - for %i in 1 to ((length of %line) - 1): + for %i in 1 to ((size of %line) - 1): unless (%line.%i is syntax tree): compile error at %line.source ".." Invalid condition for 'if' statement: @@ -371,7 +371,7 @@ compile [if %body, when %body] to: %clause = "\nelseif" - if ((length of "\%code") == 0): + if ((size of "\%code") == 0): compile error at %body.source "'if' block has an empty body" %code::append "\nend --when" return %code @@ -395,18 +395,18 @@ compile [if %branch_value is %body, when %branch_value is %body] to: compile error at %body.source "'if' expected a Block, but got: %s" for %line in %body: unless (..) - ((%line.type is "Action") and ((length of %line) >= 2)) and (..) - %line.(length of %line) is "Block" syntax tree + ((%line.type is "Action") and ((size of %line) >= 2)) and (..) + %line.(size of %line) is "Block" syntax tree ..: compile error at %line.source ".." Invalid line for 'if % is % %', each line should contain expressions followed by a block, or "else" followed by a block: %s - %action = %line.(length of %line) - if ((%line.1 is "else") and ((length of %line) == 2)): + %action = %line.(size of %line) + if ((%line.1 is "else") and ((size of %line) == 2)): unless %else_allowed: compile error at %line.source "Can't have two 'else' blocks" - unless ((length of "\%code") > 0): + unless ((size of "\%code") > 0): compile error at %line.source ".." Can't have an 'else' block without a preceeding condition @@ -418,7 +418,7 @@ compile [if %branch_value is %body, when %branch_value is %body] to: %else_allowed = (no) ..else: %code::append "\%clause " - for %i in 1 to ((length of %line) - 1): + for %i in 1 to ((size of %line) - 1): unless (%line.%i is syntax tree): compile error at %line.source ".." Invalid condition for 'if' statement: @@ -434,7 +434,7 @@ compile [if %branch_value is %body, when %branch_value is %body] to: %clause = "\nelseif" - if ((length of "\%code") == 0): + if ((size of "\%code") == 0): compile error at %body.source "'if % is % %' block has an empty body" %code::append "\nend --when" return (..) diff --git a/core/coroutines.nom b/core/coroutines.nom index 80f3b60..753a2ef 100644 --- a/core/coroutines.nom +++ b/core/coroutines.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines the code that creates and manipulates coroutines diff --git a/core/errors.nom b/core/errors.nom index 932bb25..874f2fe 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains basic error reporting code diff --git a/core/io.nom b/core/io.nom index 856a660..e47554f 100644 --- a/core/io.nom +++ b/core/io.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains basic input/output code diff --git a/core/math.nom b/core/math.nom index 778994f..6a205b6 100644 --- a/core/math.nom +++ b/core/math.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines some common math literals and functions diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 3657e02..0f894b8 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # 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 863ebc8..7e30705 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains definitions of operators like "+" and "and". @@ -286,7 +286,7 @@ compile [not %] to (Lua value "(not \(% as lua expr))") test: assume ((size of [1, 2, 3]) == 3) -compile [size of %list, length of %list, len %list, || %list ||] to (..) +compile [size of %list, size of %list, size of %list, size of %list] to (..) Lua value "(#\(%list as lua expr))" compile [%list is empty] to (Lua value "(#\(%list as lua expr) == 0)") diff --git a/core/scopes.nom b/core/scopes.nom index 392649b..6ee2939 100644 --- a/core/scopes.nom +++ b/core/scopes.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains definitions pertaining to variable scoping diff --git a/core/text.nom b/core/text.nom index 3cc979c..0232b7d 100644 --- a/core/text.nom +++ b/core/text.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 6638902..0cf1d60 100644 --- a/examples/how_do_i.nom +++ b/examples/how_do_i.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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? @@ -79,7 +79,7 @@ say %my_list.1 # List entries can be modified like this: %my_list.1 = "ONE!!!" -say (length of %my_list) +say (size of %my_list) # How do I define a dictionary/hash map? %my_dict = {x:99, y:101} diff --git a/lib/base64.nom b/lib/base64.nom index fb12319..92ce7c4 100644 --- a/lib/base64.nom +++ b/lib/base64.nom @@ -1,10 +1,10 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines actions for encoding/decoding base 64, as specified in: https://tools.ietf.org/html/rfc4648 %b64_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" -%reverse_b64 = (%b64_str.%i = (%i - 1) for %i in 1 to (length of %b64_str)) +%reverse_b64 = (%b64_str.%i = (%i - 1) for %i in 1 to (size of %b64_str)) %reverse_b64."=" = 0 test: @@ -14,15 +14,16 @@ test: assume ((base64 %plain) == %encoded) or barf ".." \(quote %plain) base64 encoded to \(quote (base64 %plain)) \ ..instead of \(quote %encoded) + assume ((base64 decode %encoded) == %plain) or barf ".." \(quote %encoded) base64 decoded to \(quote (base64 decode %encoded)) \ ..instead of \(quote %plain) action [base64 %str, base64 encode %str, %str base64]: %chars = [] - for %i in 1 to (length of %str) via 3: + for %i in 1 to (size of %str) via 3: %bytes = [=lua "\%str:byte(\%i, \(%i + 2))"] %chars::add %b64_str.(((%bytes.1 & 252) >> 2) + 1) - if (length of %bytes) is: + if (size of %bytes) is: 3: %chars::add %b64_str.(((%bytes.1 & 3) << 4) + ((%bytes.2 & 240) >> 4) + 1) %chars::add %b64_str.(((%bytes.2 & 15) << 2) + ((%bytes.3 & 192) >> 6) + 1) @@ -43,7 +44,7 @@ action [base64 %str, base64 encode %str, %str base64]: action [chr %] (=lua "string.char(\%)") action [decode base64 %str, %str base64 decoded, base64 decode %str]: %chars = [] - for %i in 1 to (length of %str) via 4: + for %i in 1 to (size of %str) via 4: %indices = (%reverse_b64.(%str.%) for % in %i to (%i + 3)) %chars::add (chr ((%indices.1 << 2) + ((%indices.2 & 48) >> 4))) if (%str.(%i + 2) == "="): stop diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom index 881109d..7809f86 100644 --- a/lib/consolecolor.nom +++ b/lib/consolecolor.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 bce8c08..35b8340 100644 --- a/lib/file_hash.nom +++ b/lib/file_hash.nom @@ -1,12 +1,11 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file defines some actions for hashing files and looking up files by hash. use "lib/os.nom" use "lib/base64.nom" -lua> ".." - local \%use_sha1, \%hashlib = pcall(require, 'openssl.digest') +lua> "local \%use_sha1, \%hashlib = pcall(require, 'openssl.digest')" test: assume ((hash "hello world") == (hash "hello world")) @@ -14,13 +13,16 @@ test: Hash collision: (hash "hello world") = \(hash "hello world") (hash "goodbye") = \(hash "goodbye") + assume (..) (..) hash ".." This is a really long string meant to stress test the hashing function and ensure that it's not overflowing with long inputs. ..!= "inf" - assume ((hash "\0") != (hash "\0\0\0\0\0")) or barf "Incorrect hashing of null strings" + + assume ((hash "\000") != (hash "\000\000\000\000\000")) or barf ".." + Incorrect hashing of null strings if %use_sha1: assume ((hash "hello world") == "Kq5sNclPz7QV2+lfQIuc6R7oRu0=") if %use_sha1: diff --git a/lib/object.nom b/lib/object.nom index 67c6b73..6aa0630 100644 --- a/lib/object.nom +++ b/lib/object.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file contains the implementation of an Object-Oriented programming system. diff --git a/lib/os.nom b/lib/os.nom index c4f9ffe..5af6543 100644 --- a/lib/os.nom +++ b/lib/os.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 6dcbb42..e98392a 100644 --- a/lib/training_wheels.nom +++ b/lib/training_wheels.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 0b11245..12e691a 100644 --- a/lib/version.nom +++ b/lib/version.nom @@ -1,3 +1,3 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # This file sets the current library version. lua> "NOMSU_LIB_VERSION = 6" diff --git a/syntax_tree.lua b/syntax_tree.lua index 6383625..8fa15b7 100644 --- a/syntax_tree.lua +++ b/syntax_tree.lua @@ -26,8 +26,7 @@ local types = { "DictEntry", "IndexChain", "Action", - "FileChunks", - "Method" + "FileChunks" } for _index_0 = 1, #types do local name = types[_index_0] diff --git a/syntax_tree.moon b/syntax_tree.moon index d0c65cc..96230a1 100644 --- a/syntax_tree.moon +++ b/syntax_tree.moon @@ -10,7 +10,7 @@ AST.is_syntax_tree = (n, t=nil)-> type(n) == 'table' and getmetatable(n) and AST[n.type] == getmetatable(n) and (t == nil or n.type == t) types = {"Number", "Var", "Block", "EscapedNomsu", "Text", "List", "Dict", "DictEntry", - "IndexChain", "Action", "FileChunks", "Method"} + "IndexChain", "Action", "FileChunks"} for name in *types cls = {} with cls diff --git a/tools/autoformat.nom b/tools/autoformat.nom index 719b826..dcccc21 100755 --- a/tools/autoformat.nom +++ b/tools/autoformat.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 051899a..7067959 100755 --- a/tools/find_action.nom +++ b/tools/find_action.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # Find an action by its stub. Usage: nomsu tools/find_action.nom "foo %" file1 file2 directory1 ... @@ -9,7 +9,7 @@ use "lib/consolecolor.nom" %stub = (command line args).1 say "Looking for stub: \%stub..." -%files = ((command line args).% for % in 2 to (|| (command line args) ||)) +%files = ((command line args).% for % in 2 to (size of (command line args))) for %path in %files: for file %filename in %path: unless (%filename matches "%.nom$") (do next %filename) diff --git a/tools/parse.nom b/tools/parse.nom index 0f71123..0622e27 100755 --- a/tools/parse.nom +++ b/tools/parse.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 ... @@ -10,8 +10,9 @@ action [print tree %t at indent %indent]: "Action": say "\(%indent)Action (\(%t.stub)):" if %t.target: - say "\(%indent) Target:" + say "\%indent Target:" print tree %t.target at indent "\%indent " + for %arg in %t: if (%arg is syntax tree): print tree %arg at indent "\%indent " diff --git a/tools/replace.nom b/tools/replace.nom index 3140675..76617cf 100755 --- a/tools/replace.nom +++ b/tools/replace.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V2.5.5.5 +#!/usr/bin/env nomsu -V3.7.5.6 # Tool to find and replace one tree with another. nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ... @@ -13,7 +13,7 @@ if (%args.1 is "-i"): %inplace = (yes) %args::remove index 1 -if ((length of %args) < 3): +if ((size of %args) < 3): say "Usage: nomsu tools/replace.nom [-i] tree_to_replace replacement files..." lua> "os.exit(1)" diff --git a/tools/test.nom b/tools/test.nom index 2446069..07f8c7d 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.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 4676f77..15f9b8c 100755 --- a/tools/upgrade.nom +++ b/tools/upgrade.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V3.6.5.6 +#!/usr/bin/env nomsu -V3.7.5.6 # Tool to automatically update code from old versions of Nomsu. Usage: nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...