Upgraded/autoformatted.
This commit is contained in:
parent
8e5f1b9e1e
commit
5027bd4f0f
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <2.3 to Nomsu 2.3
|
This file defines upgrades from Nomsu <2.3 to Nomsu 2.3
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <2.4 to Nomsu 2.4
|
This file defines upgrades from Nomsu <2.4 to Nomsu 2.4
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5
|
This file defines upgrades from Nomsu <2.5.5.5 to Nomsu 2.5.5.5
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <2.5 to Nomsu 2.5
|
This file defines upgrades from Nomsu <2.5 to Nomsu 2.5
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu 1 to Nomsu 2
|
This file defines upgrades from Nomsu 1 to Nomsu 2
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6
|
This file defines upgrades from Nomsu <3.5.5.6 to Nomsu 3.5.5.6
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <3.6 to 3.6
|
This file defines upgrades from Nomsu <3.6 to 3.6
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <3.7 to 3.7
|
This file defines upgrades from Nomsu <3.7 to 3.7
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes)
|
This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <=2 to Nomsu 3
|
This file defines upgrades from Nomsu <=2 to Nomsu 3
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <4.10.12.7 to 4.10.12.7
|
This file defines upgrades from Nomsu <4.10.12.7 to 4.10.12.7
|
||||||
use "compatibility/compatibility.nom"
|
use "compatibility/compatibility.nom"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <4.11 to Nomsu 4.11
|
This file defines upgrades from Nomsu <4.11 to Nomsu 4.11
|
||||||
(overhaul of function literals, deleting (if all of ...), etc. shorthand)
|
(overhaul of function literals, deleting (if all of ...), etc. shorthand)
|
||||||
@ -45,8 +45,11 @@ upgrade action (line number of %pos in %text) to "4.11" as (..)
|
|||||||
|
|
||||||
# Deduplicating goto labels:
|
# Deduplicating goto labels:
|
||||||
upgrade action [=== %label ===, *** %label ***] to "4.11" as (--- %label ---)
|
upgrade action [=== %label ===, *** %label ***] to "4.11" as (--- %label ---)
|
||||||
upgrade action [===stop %label ===, ***stop %label ***] to "4.11" as (---stop %label ---)
|
upgrade action [===stop %label ===, ***stop %label ***] to "4.11" as (..)
|
||||||
upgrade action [===next %label ===, ***next %label ***] to "4.11" as (---next %label ---)
|
---stop %label ---
|
||||||
|
|
||||||
|
upgrade action [===next %label ===, ***next %label ***] to "4.11" as (..)
|
||||||
|
---next %label ---
|
||||||
|
|
||||||
# Deprecating shorthand functions:
|
# Deprecating shorthand functions:
|
||||||
upgrade action [if all of %items %body, if all of %items then %body] to "4.11" as (..)
|
upgrade action [if all of %items %body, if all of %items then %body] to "4.11" as (..)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.12
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <4.11 to Nomsu 4.11
|
This file defines upgrades from Nomsu <4.11 to Nomsu 4.11
|
||||||
(overhaul of function literals, deleting (if all of ...), etc. shorthand)
|
(overhaul of function literals, deleting (if all of ...), etc. shorthand)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means")
|
This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means")
|
||||||
use "compatibility/compatibility.nom"
|
use "compatibility/compatibility.nom"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines upgrades from Nomsu <4.9 to 4.9
|
This file defines upgrades from Nomsu <4.9 to 4.9
|
||||||
use "compatibility/compatibility.nom"
|
use "compatibility/compatibility.nom"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains code for defining ways to upgrade code between different versions
|
This file contains code for defining ways to upgrade code between different versions
|
||||||
of Nomsu.
|
of Nomsu.
|
||||||
@ -92,11 +92,13 @@ externally [..]
|
|||||||
add %k = (%v upgraded from %start_version to %end_version)
|
add %k = (%v upgraded from %start_version to %end_version)
|
||||||
set %with_upgraded_args's metatable to (%tree's metatable)
|
set %with_upgraded_args's metatable to (%tree's metatable)
|
||||||
%tree = (%UPGRADES.%ver %with_upgraded_args %end_version)
|
%tree = (%UPGRADES.%ver %with_upgraded_args %end_version)
|
||||||
|
|
||||||
if (%tree.version != %end_version):
|
if (%tree.version != %end_version):
|
||||||
%tree = (SyntaxTree {: for %k = %v in %tree: add %k = %v})
|
%tree = (SyntaxTree {: for %k = %v in %tree: add %k = %v})
|
||||||
%tree.version = %end_version
|
%tree.version = %end_version
|
||||||
if %tree.shebang:
|
if %tree.shebang:
|
||||||
%tree.shebang = "#!/usr/bin/env nomsu -V\%end_version\n"
|
%tree.shebang = "#!/usr/bin/env nomsu -V\%end_version\n"
|
||||||
|
|
||||||
return %tree
|
return %tree
|
||||||
|
|
||||||
externally (%tree upgraded from %start_version) means (..)
|
externally (%tree upgraded from %start_version) means (..)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains code that supports manipulating and using collections like lists
|
This file contains code that supports manipulating and using collections like lists
|
||||||
and dictionaries.
|
and dictionaries.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains compile-time actions that define basic control flow structures
|
This file contains compile-time actions that define basic control flow structures
|
||||||
like "if" statements and loops.
|
like "if" statements and loops.
|
||||||
@ -87,10 +87,16 @@ test:
|
|||||||
assume (%i == 0)
|
assume (%i == 0)
|
||||||
|
|
||||||
(--- %label ---) compiles to "\
|
(--- %label ---) compiles to "\
|
||||||
..::label_\((%label.stub::as lua id) if (%label.type == "Action") else (%label as lua identifier))::"
|
..::label_\(..)
|
||||||
|
(%label.stub::as lua id) if (%label.type == "Action") else (..)
|
||||||
|
%label as lua identifier
|
||||||
|
..::"
|
||||||
|
|
||||||
(go to %label) compiles to "\
|
(go to %label) compiles to "\
|
||||||
..goto label_\((%label.stub::as lua id) if (%label.type == "Action") else (%label as lua identifier))"
|
..goto label_\(..)
|
||||||
|
(%label.stub::as lua id) if (%label.type == "Action") else (..)
|
||||||
|
%label as lua identifier
|
||||||
|
.."
|
||||||
|
|
||||||
# Basic loop control
|
# Basic loop control
|
||||||
(stop %var) compiles to:
|
(stop %var) compiles to:
|
||||||
@ -105,11 +111,8 @@ test:
|
|||||||
..else:
|
..else:
|
||||||
return (Lua "goto continue")
|
return (Lua "goto continue")
|
||||||
|
|
||||||
(---stop %var ---) compiles to "\
|
(---stop %var ---) compiles to "::stop_\(%var as lua identifier)::"
|
||||||
..::stop_\(%var as lua identifier)::"
|
(---next %var ---) compiles to "::continue_\(%var as lua identifier)::"
|
||||||
|
|
||||||
(---next %var ---) compiles to "\
|
|
||||||
..::continue_\(%var as lua identifier)::"
|
|
||||||
|
|
||||||
# While loops
|
# While loops
|
||||||
test:
|
test:
|
||||||
@ -124,12 +127,14 @@ test:
|
|||||||
do next
|
do next
|
||||||
barf "Failed to 'do next'"
|
barf "Failed to 'do next'"
|
||||||
assume (%x == 20)
|
assume (%x == 20)
|
||||||
|
|
||||||
(repeat while %condition %body) compiles to:
|
(repeat while %condition %body) compiles to:
|
||||||
%lua = (Lua "while \(%condition as lua expr) do\n \(%body as lua)")
|
%lua = (Lua "while \(%condition as lua expr) do\n \(%body as lua)")
|
||||||
if (%body has subtree \(do next)):
|
if (%body has subtree \(do next)):
|
||||||
%lua::append "\n ::continue::"
|
%lua::append "\n ::continue::"
|
||||||
%lua::append "\nend --while-loop"
|
%lua::append "\nend --while-loop"
|
||||||
return %lua
|
return %lua
|
||||||
|
|
||||||
(repeat %body) parses as (repeat while (yes) %body)
|
(repeat %body) parses as (repeat while (yes) %body)
|
||||||
(repeat until %condition %body) parses as (repeat while (not %condition) %body)
|
(repeat until %condition %body) parses as (repeat while (not %condition) %body)
|
||||||
|
|
||||||
@ -185,10 +190,11 @@ test:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
%x = 0
|
%x = 0
|
||||||
repeat 5 times: %x += 1
|
repeat 5 times:
|
||||||
|
%x += 1
|
||||||
assume %x == 5
|
assume %x == 5
|
||||||
(repeat %n times %body) parses as (for (=lua "_XXX_") in 1 to %n %body)
|
|
||||||
|
|
||||||
|
(repeat %n times %body) parses as (for (=lua "_XXX_") in 1 to %n %body)
|
||||||
test:
|
test:
|
||||||
%a = [10, 20, 30, 40, 50]
|
%a = [10, 20, 30, 40, 50]
|
||||||
%b = []
|
%b = []
|
||||||
@ -229,7 +235,8 @@ test:
|
|||||||
%lua::append "\nend -- end of scope for stopping for-loop"
|
%lua::append "\nend -- end of scope for stopping for-loop"
|
||||||
return %lua
|
return %lua
|
||||||
|
|
||||||
(for %var in %iterable %body) parses as (for %var in %iterable at (=lua "__") %body)
|
(for %var in %iterable %body) parses as (..)
|
||||||
|
for %var in %iterable at (=lua "__") %body
|
||||||
|
|
||||||
test:
|
test:
|
||||||
%d = {a: 10, b: 20, c: 30, d: 40, e: 50}
|
%d = {a: 10, b: 20, c: 30, d: 40, e: 50}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines the code that creates and manipulates coroutines
|
This file defines the code that creates and manipulates coroutines
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains basic error reporting code
|
This file contains basic error reporting code
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
A simple UUID function based on RFC 4122: http://www.ietf.org/rfc/rfc4122.txt
|
A simple UUID function based on RFC 4122: http://www.ietf.org/rfc/rfc4122.txt
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains basic input/output code
|
This file contains basic input/output code
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines some common math literals and functions
|
This file defines some common math literals and functions
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This File contains actions for making actions and compile-time actions and some helper
|
This File contains actions for making actions and compile-time actions and some helper
|
||||||
functions to make that easier.
|
functions to make that easier.
|
||||||
@ -373,7 +373,8 @@ externally (type of %) means:
|
|||||||
test:
|
test:
|
||||||
assume ((run "return (2 + 99)") == 101)
|
assume ((run "return (2 + 99)") == 101)
|
||||||
%x = 0
|
%x = 0
|
||||||
externally (set to %) means: external %x = %
|
externally (set to %) means:
|
||||||
|
external %x = %
|
||||||
run "set to 1"
|
run "set to 1"
|
||||||
assume %x == 1
|
assume %x == 1
|
||||||
assume (run \(return \(\(5) + \(5)))) == 10
|
assume (run \(return \(\(5) + \(5)))) == 10
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains definitions of operators like "+" and "and".
|
This file contains definitions of operators like "+" and "and".
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains some definitions of text escape sequences, including ANSI console
|
This file contains some definitions of text escape sequences, including ANSI console
|
||||||
color codes.
|
color codes.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
# How do I...
|
# How do I...
|
||||||
# Write a comment? Put a # and go till the end of the line
|
# Write a comment? Put a # and go till the end of the line
|
||||||
# How do I write a multi-line comment?
|
# How do I write a multi-line comment?
|
||||||
@ -166,8 +166,7 @@ repeat until (%x > 3):
|
|||||||
repeat:
|
repeat:
|
||||||
say "repeat loop #\%x"
|
say "repeat loop #\%x"
|
||||||
%x += 1
|
%x += 1
|
||||||
if (%x > 3):
|
if (%x > 3): stop
|
||||||
stop repeating
|
|
||||||
|
|
||||||
# How do I do a 'goto'?
|
# How do I do a 'goto'?
|
||||||
do:
|
do:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines actions for encoding/decoding base 64, as specified in:
|
This file defines actions for encoding/decoding base 64, as specified in:
|
||||||
https://tools.ietf.org/html/rfc4648
|
https://tools.ietf.org/html/rfc4648
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines actions for ANSI console color escape codes.
|
This file defines actions for ANSI console color escape codes.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines some actions for hashing files and looking up files by hash.
|
This file defines some actions for hashing files and looking up files by hash.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file contains the implementation of an Object-Oriented programming system.
|
This file contains the implementation of an Object-Oriented programming system.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines some actions that interact with the operating system and filesystem.
|
This file defines some actions that interact with the operating system and filesystem.
|
||||||
|
|
||||||
@ -28,7 +28,6 @@ test:
|
|||||||
read file "lib/os.nom"
|
read file "lib/os.nom"
|
||||||
|
|
||||||
externally (read file %filename) means (=lua "Files.read(\%filename)")
|
externally (read file %filename) means (=lua "Files.read(\%filename)")
|
||||||
|
|
||||||
externally [..]
|
externally [..]
|
||||||
write to file %filename %text, to file %filename write %text
|
write to file %filename %text, to file %filename write %text
|
||||||
write %text to file %filename
|
write %text to file %filename
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
A library for simple object oriented programming.
|
A library for simple object oriented programming.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Auto-format Nomsu code. Usage:
|
Auto-format Nomsu code. Usage:
|
||||||
nomsu tools/autoformat.nom [-i] file1 file2 directory1 ...
|
nomsu tools/autoformat.nom [-i] file1 file2 directory1 ...
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Find an action by its stub. Usage:
|
Find an action by its stub. Usage:
|
||||||
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
|
nomsu tools/find_action.nom "foo %" file1 file2 directory1 ...
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Tool to print out a parse tree of files in an easy-to-read format. Usage:
|
Tool to print out a parse tree of files in an easy-to-read format. Usage:
|
||||||
nomsu tools/parse.nom file1 file2 directory1 ...
|
nomsu tools/parse.nom file1 file2 directory1 ...
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
This file defines a Read-Evaluate-Print-Loop (REPL) for Nomsu
|
This file defines a Read-Evaluate-Print-Loop (REPL) for Nomsu
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Tool to find and replace one tree with another.
|
Tool to find and replace one tree with another.
|
||||||
nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ...
|
nomsu tools/replace.nom [-i] tree_to_replace replacement file1 file2 directory1 ...
|
||||||
@ -10,29 +10,25 @@ use "lib/os.nom"
|
|||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
barf "Deprecated."
|
barf "Deprecated."
|
||||||
|
|
||||||
if ((size of %args.extra_args) < 3):
|
if ((size of %args.extra_args) < 3):
|
||||||
say "Usage: nomsu tools/replace.nom [-i] tree_to_replace replacement files..."
|
say "Usage: nomsu tools/replace.nom [-i] tree_to_replace replacement files..."
|
||||||
lua> "os.exit(1)"
|
lua> "os.exit(1)"
|
||||||
|
%pattern = (%args.extra_args.1 parsed)
|
||||||
%pattern = ((%args.extra_args.1) parsed)
|
%replacement = (%args.extra_args.2 parsed)
|
||||||
%replacement = ((%args.extra_args.2) parsed)
|
|
||||||
for %filename in %args.extra_args at %i:
|
for %filename in %args.extra_args at %i:
|
||||||
if (%i < 3): do next %i
|
if (%i < 3):
|
||||||
|
do next %i
|
||||||
%file = (read file %filename)
|
%file = (read file %filename)
|
||||||
unless %file: barf "File does not exist: \%filename"
|
unless %file:
|
||||||
|
barf "File does not exist: \%filename"
|
||||||
%nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file)
|
%nomsu = (NomsuCode from (Source %filename 1 (size of %file)) %file)
|
||||||
%tree = (%nomsu parsed)
|
%tree = (%nomsu parsed)
|
||||||
|
|
||||||
# TODO: fix this to use variable substitution
|
# TODO: fix this to use variable substitution
|
||||||
%tree2 = (..)
|
%tree2 = (%tree::map (for %subtree: if (%subtree == %pattern): return %replacement))
|
||||||
%tree::map (..)
|
|
||||||
for %subtree:
|
|
||||||
if (%subtree == %pattern):
|
|
||||||
return %replacement
|
|
||||||
if (%tree2 == %tree):
|
if (%tree2 == %tree):
|
||||||
say "No changes in \%filename"
|
say "No changes in \%filename"
|
||||||
do next %filename
|
do next %filename
|
||||||
|
|
||||||
%text = ((%tree2 as nomsu)::text)
|
%text = ((%tree2 as nomsu)::text)
|
||||||
when:
|
when:
|
||||||
%args."-i":
|
%args."-i":
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Tool to run all tests in a file (i.e. the code block inside a call to 'test %'). Usage:
|
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 ...
|
nomsu tools/test.nom file1 file2 directory1 ...
|
||||||
@ -18,9 +18,7 @@ for %filename in (command line args).extra_args:
|
|||||||
for %src = %test in %tests:
|
for %src = %test in %tests:
|
||||||
if (%src.filename == %filename):
|
if (%src.filename == %filename):
|
||||||
if %version:
|
if %version:
|
||||||
%test = "\
|
%test = "#!/usr/bin/env nomsu -V\%version\n\%test"
|
||||||
..#!/usr/bin/env nomsu -V\(%version)
|
|
||||||
\%test"
|
|
||||||
%file_tests::add {test: %test, source: %src}
|
%file_tests::add {test: %test, source: %src}
|
||||||
|
|
||||||
unless (%file_tests is empty):
|
unless (%file_tests is empty):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env nomsu -V4.11.12.8
|
#!/usr/bin/env nomsu -V4.12.12.8
|
||||||
#
|
#
|
||||||
Tool to automatically update code from old versions of Nomsu. Usage:
|
Tool to automatically update code from old versions of Nomsu. Usage:
|
||||||
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
|
nomsu tools/upgrade.nom [-i] file1 file2 directory1 ...
|
||||||
|
Loading…
Reference in New Issue
Block a user