aboutsummaryrefslogtreecommitdiff
path: root/compatibility
diff options
context:
space:
mode:
Diffstat (limited to 'compatibility')
-rw-r--r--compatibility/2.3.nom2
-rw-r--r--compatibility/2.4.nom2
-rw-r--r--compatibility/2.5.5.5.nom14
-rw-r--r--compatibility/2.5.nom2
-rw-r--r--compatibility/2.nom2
-rw-r--r--compatibility/compatibility.nom73
6 files changed, 58 insertions, 37 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index 0127d15..d428b4c 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -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
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index 3037078..2c5cc8e 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -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
diff --git a/compatibility/2.5.5.5.nom b/compatibility/2.5.5.5.nom
new file mode 100644
index 0000000..d127294
--- /dev/null
+++ b/compatibility/2.5.5.5.nom
@@ -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)"
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index b9574f4..128bf6a 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -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
diff --git a/compatibility/2.nom b/compatibility/2.nom
index c16f73c..399d485 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -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
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 61818d6..982cec6 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -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
of Nomsu.
@@ -18,39 +18,46 @@ action [upgrade action %stub to %version via %upgrade_fn]:
parse [upgrade %tree to %version as %body] as (..)
upgrade to %version via ([%] -> (% with %tree -> %body))
-compile [upgrade action %action to %version as %body] to:
- %replacements = {}
- for %i in 1 to (length of %action):
- if (%action.%i.type is "Var"):
- %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]"
-
- local action [make tree %t]:
- when:
- (%t is "Var" syntax tree):
- if %replacements.(%t.1):
- return %replacements.(%t.1)
- ..else:
- return ".."
- \(%t.type)(\(quote "\(%t.source)"), \(..)
- quote "\(%t.1) \000\(=lua "string.format('%X', __MANGLE_INDEX)")"
- ..)
-
- (%t is syntax tree):
- %args = ((make tree %) for % in %t)
- add "\(\%tree as lua id).source" to %args at index 1
- return "\(%t.type)(\(%args joined with ", "))"
-
- else:
- return (quote "\%t")
+compile [upgrade action %actions to %version as %body] to:
+ if (%actions is "Action" syntax tree):
+ %actions = [%actions]
+ %lua = (Lua "")
+ for %action in %actions:
+ %replacements = {}
+ for %i in 1 to (length of %action):
+ if (%action.%i.type is "Var"):
+ %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]"
+
+ local action [make tree %t]:
+ when:
+ (%t is "Var" syntax tree):
+ if %replacements.(%t.1):
+ return %replacements.(%t.1)
+ ..else:
+ return ".."
+ \(%t.type)(\(quote "\(%t.source)"), \(..)
+ quote "\(%t.1) \000\(=lua "string.format('%X', __MANGLE_INDEX)")"
+ ..)
+
+ (%t is syntax tree):
+ %args = ((make tree %) for % in %t)
+ add "\(\%tree as lua id).source" to %args at index 1
+ return "\(%t.type)(\(%args joined with ", "))"
+
+ else:
+ return (quote "\%t")
+
+ unless ("\%lua" == ""): to %lua write "\n"
+ to %lua write (..)
+ Lua ".."
+ A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
+ \%tree as lua id
+ ..)
+ __MANGLE_INDEX = (__MANGLE_INDEX or 0) + 1
+ return \(make tree %body)
+ end)
- return (..)
- Lua ".."
- A_upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..)
- \%tree as lua id
- ..)
- __MANGLE_INDEX = (__MANGLE_INDEX or 0) + 1
- return \(make tree %body)
- end)
+ return %lua
action [..]
%tree upgraded from %start_version to %end_version