aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-02-06 15:33:10 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-02-06 15:34:00 -0800
commit057f5b74ebb7851f6ba824129b3e3316cae23260 (patch)
tree2561ca637f5db834cb8f8b82831cbbbbc26d71ae /lib
parent618e48ad98c0e2b36eb22c75251dddc141d822e6 (diff)
Moving to better, more centralized versioning system. Now the Nomsu
version is just defined as a list at the top of nomsu.moon, and uses X.Y.Z form instead of X.Y.Z.W. Added a ([...], from 2) method and a ([...], up to 5) method, and fixed a few upgrade bugs.
Diffstat (limited to 'lib')
-rw-r--r--lib/compatibility/7.nom12
-rw-r--r--lib/compatibility/compatibility.nom17
-rw-r--r--lib/compatibility/init.nom3
-rw-r--r--lib/core/metaprogramming.nom12
-rwxr-xr-xlib/tools/repl.nom4
-rwxr-xr-xlib/tools/upgrade.nom4
6 files changed, 30 insertions, 22 deletions
diff --git a/lib/compatibility/7.nom b/lib/compatibility/7.nom
index fb313c3..fe31ec6 100644
--- a/lib/compatibility/7.nom
+++ b/lib/compatibility/7.nom
@@ -1,5 +1,5 @@
#!/usr/bin/env nomsu -V7
-#
+###
This file defines upgrades from Nomsu <7 to 7
use "compatibility/compatibility"
@@ -22,3 +22,13 @@ upgrade $tree to "7" as:
return
"Action" tree from $tree.source with ("Text" tree with $e.type) "tree" "with"
unpack $e
+
+upgrade action "Nomsu version" to "7" via ->(`$(NOMSU VERSION))
+upgrade action [
+ "Nomsu syntax version", "Nomsu compiler version", "core version", "lib version"
+] to "7" via:
+ for $:
+ at $.source fail ("
+ Deprecation error: Actions for accessing specific parts of the version number have been deprecated.
+ Hint: Use $(NOMSU VERSION).1, etc. instead.
+ ")
diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom
index a7ca0c1..c1c83d3 100644
--- a/lib/compatibility/compatibility.nom
+++ b/lib/compatibility/compatibility.nom
@@ -70,8 +70,15 @@ external:
$tree upgraded to $end_version from $start_version
] all mean:
unless ($tree is syntax tree): return $tree
- ($ver as version list) means (($ as number) for $ in $ver matching "[0-9]+")
+ ($ver as version list) means:
+ if ($ver is "Text"):
+ return (($ as number) for $ in $ver matching "[0-9]+")
+ return $ver
(Ver $) means:
+ if ($ is "a List"):
+ if ($.1 is "Text"):
+ return {.lib = $.1, .version = ($, from 2)}
+ return {.version = $}
[$lib, $ver] = ($, match "(.*)/([0-9.]+)")
if $lib:
return {.lib = $lib, .version = ($ver as version list)}
@@ -117,15 +124,15 @@ external:
$tree = (SyntaxTree {: for $k = $v in $tree: add $k = $v})
$tree.version = $end_version
if $tree.shebang:
- $tree.shebang = "#!/usr/bin/env nomsu -V\$end_version\n"
+ $tree.shebang = "#!/usr/bin/env nomsu -V\($end_version, joined with ".")\n"
return $tree
($tree upgraded from $start_version) means
- $tree upgraded from $start_version to (Nomsu version)
+ $tree upgraded from $start_version to $(NOMSU VERSION)
($tree upgraded to $end_version) means
- $tree upgraded from ($tree.version or (Nomsu version)) to $end_version
+ $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $end_version
($tree upgraded) means
- $tree upgraded from ($tree.version or (Nomsu version)) to (Nomsu version)
+ $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION)
diff --git a/lib/compatibility/init.nom b/lib/compatibility/init.nom
index 42834bb..90d2ca5 100644
--- a/lib/compatibility/init.nom
+++ b/lib/compatibility/init.nom
@@ -17,3 +17,6 @@ export "compatibility/4.11"
export "compatibility/4.12"
export "compatibility/5.13"
export "compatibility/6.14"
+export "compatibility/6.15"
+export "compatibility/6.15.9"
+export "compatibility/7"
diff --git a/lib/core/metaprogramming.nom b/lib/core/metaprogramming.nom
index c310fdd..55cab2a 100644
--- a/lib/core/metaprogramming.nom
+++ b/lib/core/metaprogramming.nom
@@ -3,8 +3,6 @@
This File contains actions for making actions and compile-time actions and some helper
functions to make that easier.
-lua> "NOMSU_CORE_VERSION = 15"
-lua> "NOMSU_LIB_VERSION = 9"
lua> ("
do
local mangle_index = 0
@@ -462,10 +460,6 @@ test:
(yes) compiles to "(true)"
(no) compiles to "(false)"
[nothing, nil, null] all compile to "(nil)"
-(Nomsu syntax version) compiles to "NOMSU_SYNTAX_VERSION"
-(Nomsu compiler version) compiles to "NOMSU_COMPILER_VERSION"
-(core version) compiles to "NOMSU_CORE_VERSION"
-(lib version) compiles to "NOMSU_LIB_VERSION"
(command line args) compiles to "COMMAND_LINE_ARGS"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -496,12 +490,6 @@ test:
return lua
")
-external:
- (Nomsu version) means:
- return ("
- \(Nomsu syntax version).\(core version).\(Nomsu compiler version).\(lib version)
- ")
-
~~~~
# TODO: Remove shim
($tree with $t -> $replacement) parses as
diff --git a/lib/tools/repl.nom b/lib/tools/repl.nom
index 5e8336f..716c899 100755
--- a/lib/tools/repl.nom
+++ b/lib/tools/repl.nom
@@ -11,7 +11,7 @@ use "commandline"
external:
(help) means:
say ("
- This is the Nomsu v\(Nomsu version) interactive console.
+ This is the Nomsu v\($(NOMSU VERSION), joined with ".") interactive console.
You can type in Nomsu code here and hit 'enter' twice to run it.
To exit, type 'exit' or 'quit' and hit enter twice.
")
@@ -23,7 +23,7 @@ external:
command line program with $args:
say ("
- \(bright)\(underscore)Welcome to the Nomsu v\(Nomsu version) interactive console!\
+ \(bright)\(underscore)Welcome to the Nomsu v\($(NOMSU VERSION), joined with ".") interactive console!\
..\(reset color)
press 'enter' twice to run a command
type 'tutorial' to run the tutorial
diff --git a/lib/tools/upgrade.nom b/lib/tools/upgrade.nom
index 30b6cab..f4a2b8c 100755
--- a/lib/tools/upgrade.nom
+++ b/lib/tools/upgrade.nom
@@ -20,7 +20,7 @@ command line program with $args:
use $start_version
..if it fails:
fail "Could not find upgrade rules for \$start_version"
- $version = ($args."upgrade-to" or (Nomsu version))
+ $version = ($args."upgrade-to" or $(NOMSU VERSION))
$test = ($args.t or $args.test)
for $filename in $args.extras:
$file = (read file $filename)
@@ -30,7 +30,7 @@ command line program with $args:
$code = (NomsuCode from (Source $filename 1 (size of $file)) $file)
$tree = ($code parsed $start_version)
$uptree =
- $tree upgraded from ($start_version or ($tree.version or (Nomsu version))) to
+ $tree upgraded from ($start_version or ($tree.version or $(NOMSU VERSION))) to
$version
$text = "\$leading_indent\($uptree as nomsu, text, with "\n" -> "\n\$leading_indent")"
when: