Added compatibility for 2.5.5.5 (file hash changes).

This commit is contained in:
Bruce Hill 2018-07-30 19:39:32 -07:00
parent 56143adf97
commit c6a7b0be9e
29 changed files with 82 additions and 61 deletions

View File

@ -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 This file defines upgrades from Nomsu <2.3 to Nomsu 2.3

View File

@ -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 This file defines upgrades from Nomsu <2.4 to Nomsu 2.4

14
compatibility/2.5.5.5.nom Normal file
View File

@ -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)"

View File

@ -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 This file defines upgrades from Nomsu <2.5 to Nomsu 2.5

View File

@ -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 This file defines upgrades from Nomsu 1 to Nomsu 2

View File

@ -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 This file contains code for defining ways to upgrade code between different versions
of Nomsu. of Nomsu.
@ -18,7 +18,11 @@ action [upgrade action %stub to %version via %upgrade_fn]:
parse [upgrade %tree to %version as %body] as (..) parse [upgrade %tree to %version as %body] as (..)
upgrade to %version via ([%] -> (% with %tree -> %body)) upgrade to %version via ([%] -> (% with %tree -> %body))
compile [upgrade action %action to %version as %body] to: compile [upgrade action %actions to %version as %body] to:
if (%actions is "Action" syntax tree):
%actions = [%actions]
%lua = (Lua "")
for %action in %actions:
%replacements = {} %replacements = {}
for %i in 1 to (length of %action): for %i in 1 to (length of %action):
if (%action.%i.type is "Var"): if (%action.%i.type is "Var"):
@ -43,7 +47,8 @@ compile [upgrade action %action to %version as %body] to:
else: else:
return (quote "\%t") return (quote "\%t")
return (..) unless ("\%lua" == ""): to %lua write "\n"
to %lua write (..)
Lua ".." Lua ".."
A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..) A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
\%tree as lua id \%tree as lua id
@ -52,6 +57,8 @@ compile [upgrade action %action to %version as %body] to:
return \(make tree %body) return \(make tree %body)
end) end)
return %lua
action [..] action [..]
%tree upgraded from %start_version to %end_version %tree upgraded from %start_version to %end_version
%tree upgraded to %end_version from %start_version %tree upgraded to %end_version from %start_version

View File

@ -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 This file contains code that supports manipulating and using collections like lists
and dictionaries. and dictionaries.

View File

@ -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 This file contains compile-time actions that define basic control flow structures
like "if" statements and loops. like "if" statements and loops.

View File

@ -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 This file defines the code that creates and manipulates coroutines

View File

@ -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 This file contains basic error reporting code

View File

@ -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 This file contains basic input/output code

View File

@ -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 This file defines some common math literals and functions

View File

@ -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 This File contains actions for making actions and compile-time actions and some helper
functions to make that easier. functions to make that easier.

View File

@ -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". This file contains definitions of operators like "+" and "and".

View File

@ -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 This file contains definitions pertaining to variable scoping

View File

@ -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 This file contains some definitions of text escape sequences, including ANSI console
color codes. color codes.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env nomsu -V2.5.5.4 #!/usr/bin/env nomsu -V2.5.5.5
# 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?

View File

@ -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: This file defines actions for encoding/decoding base 64, as specified in:
https://tools.ietf.org/html/rfc4648 https://tools.ietf.org/html/rfc4648

View File

@ -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. This file defines actions for ANSI console color escape codes.

View File

@ -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. This file defines some actions for hashing files and looking up files by hash.

View File

@ -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. This file contains the implementation of an Object-Oriented programming system.

View File

@ -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. This file defines some actions that interact with the operating system and filesystem.

View File

@ -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 This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "||" and "continue") from other languages into nomsu (e.g. "||" and "continue")

View File

@ -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. # This file sets the current library version.
lua> "NOMSU_LIB_VERSION = 5" lua> "NOMSU_LIB_VERSION = 5"

View File

@ -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: Auto-format Nomsu code. Usage:
nomsu tools/autoformat.nom [-i] file1 file2 directory1 ... nomsu tools/autoformat.nom [-i] file1 file2 directory1 ...

View File

@ -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: 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 ...

View File

@ -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: 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 ...

View File

@ -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: 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 ...

View File

@ -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: 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 ...