From ea3197aaffba00318920ed5e1e33ca5f2a5e6c5c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 30 Oct 2018 23:42:04 -0700 Subject: Fully working version of (action [foo]: baz) -> ((foo) means: baz) refactor and misc other changes. --- compatibility/compatibility.nom | 43 ++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'compatibility') diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index acd1d11..6da7063 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file contains code for defining ways to upgrade code between different versions of Nomsu. @@ -6,17 +6,17 @@ use "lib/os.nom" %UPGRADES = {} -action [upgrade to %version via %upgrade_fn]: +externally (upgrade to %version via %upgrade_fn) means: %UPGRADES.%version = %upgrade_fn %ACTION_UPGRADES = ({} with fallback % -> {}) -action [upgrade action %stub to %version via %upgrade_fn]: +externally (upgrade action %stub to %version via %upgrade_fn) means: %ACTION_UPGRADES.%version.%stub = %upgrade_fn -parse [upgrade %tree to %version as %body] as (..) - upgrade to %version via ([%] -> (% with %tree -> %body)) +(upgrade %tree to %version as %body) parses as (..) + upgrade to %version via ([%, %end_version] -> (% with %tree -> %body)) -compile [upgrade action %actions to %version as %body] to: +(upgrade action %actions to %version as %body) compiles to: if (%actions is "Action" syntax tree): %actions = \[%actions] %lua = (Lua "") @@ -27,7 +27,7 @@ compile [upgrade action %actions to %version as %body] to: %replacements.(%action.%i.1) = "\(\%tree as lua id)[\%i]" define mangler - local action [make tree %t]: + (make tree %t) means: when: (%t is "Var" syntax tree): if %replacements.(%t.1): @@ -60,11 +60,12 @@ compile [upgrade action %actions to %version as %body] to: return %lua -action [..] +externally [..] %tree upgraded from %start_version to %end_version %tree upgraded to %end_version from %start_version -..: - local action [%ver as list] ((% as number) for % in %ver matching "[0-9]+") +..all mean: + unless (%tree is syntax tree): return %tree + (%ver as list) means ((% as number) for % in %ver matching "[0-9]+") %versions = {} for %v = % in %UPGRADES: %versions.%v = (yes) @@ -78,25 +79,31 @@ action [..] %tree = (..) %tree with % -> (..) if ((% is "Action" syntax tree) and %ACTION_UPGRADES.%ver.(%.stub)): - return (call %ACTION_UPGRADES.%ver.(%.stub) with [%]) + %with_upgraded_args = (..) + %k = (%v upgraded from %start_version to %end_version) \ + ..for %k = %v in % + set %with_upgraded_args's metatable to (%'s metatable) + return (call %ACTION_UPGRADES.%ver.(%.stub) with [%with_upgraded_args, %end_version]) if %UPGRADES.%ver: - %tree = (call %UPGRADES.%ver with [%tree]) + %with_upgraded_args = (..) + %k = (%v upgraded from %start_version to %end_version) \ + ..for %k = %v in %tree + set %with_upgraded_args's metatable to (%tree's metatable) + %tree = (call %UPGRADES.%ver with [%with_upgraded_args, %end_version]) return %tree -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -parse [%tree upgraded from %start_version] as (..) +externally (%tree upgraded from %start_version) means (..) %tree upgraded from %start_version to (Nomsu version) -parse [%tree upgraded to %end_version] as (..) +externally (%tree upgraded to %end_version) means (..) %tree upgraded from (%tree.version or (Nomsu version)) to %end_version -parse [%tree upgraded] as (..) +externally (%tree upgraded) means (..) %tree upgraded from (%tree.version or (Nomsu version)) to (Nomsu version) -action [use %path from version %version]: +externally (use %path from version %version) means: for file %filename in %path: if (=lua "LOADED[\%filename]"): do next %filename %file = (read file %filename) -- cgit v1.2.3 From f43d8c58f755a7f208d84b43071490ab356c5ac8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Oct 2018 03:54:16 -0700 Subject: Added upgrade file. --- compatibility/4.8.10.nom | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 compatibility/4.8.10.nom (limited to 'compatibility') diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom new file mode 100644 index 0000000..58fd376 --- /dev/null +++ b/compatibility/4.8.10.nom @@ -0,0 +1,59 @@ +#!/usr/bin/env nomsu -V4.8.10.6 +# + This file defines upgrades from Nomsu <4.8.10 to 4.8.10 (renaming "action" -> "means") +use "compatibility/compatibility.nom" + +upgrade action "local action 1 2" to "4.8.10" via (..) + [%tree, %end_version] ->: + %spec = %tree.3 + %body = %tree.4 + if %spec.type is: + "List": + if ((size of %spec) == 1): + return \(%spec.1 means %body) + ..else: + return \(%spec all mean %body) + else: + return \(%spec means %body) + +upgrade action "action 1 2" to "4.8.10" via (..) + [%tree, %end_version] ->: + %spec = %tree.2 + %body = %tree.3 + if %spec.type is: + "List": + if ((size of %spec) == 1): + return \(externally %spec.1 means %body) + ..else: + return \(externally %spec all mean %body) + else: + return \(externally %spec means %body) + +upgrade action "compile 1 to 2" to "4.8.10" via (..) + [%tree, %end_version] ->: + %spec = %tree.2 + %body = %tree.4 + if %spec.type is: + "List": + if ((size of %spec) == 1): + return \(%spec.1 compiles to %body) + ..else: + return \(%spec all compile to %body) + else: + return \(%spec compiles to %body) + +upgrade action "parse 1 as 2" to "4.8.10" via (..) + [%tree, %end_version] ->: + %spec = %tree.2 + %body = %tree.4 + if %spec.type is: + "List": + if ((size of %spec) == 1): + return \(%spec.1 parses as %body) + ..else: + return \(%spec all parse as %body) + else: + return \(%spec parse as %body) + +upgrade action (compile as %) to "4.8.10" as (what % compiles to) + -- cgit v1.2.3 From 7a35e38d8778670fe0662f203e82638355db3bba Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 31 Oct 2018 15:05:17 -0700 Subject: Renamed (action %) -> (%'s meaning) --- 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 | 2 +- compatibility/3.5.5.6.nom | 2 +- compatibility/3.6.nom | 2 +- compatibility/3.7.nom | 2 +- compatibility/3.8.nom | 2 +- compatibility/3.nom | 2 +- compatibility/4.8.10.nom | 2 +- compatibility/compatibility.nom | 13 ++++++------- 12 files changed, 17 insertions(+), 18 deletions(-) (limited to 'compatibility') diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom index fb137b8..7de353e 100644 --- a/compatibility/2.3.nom +++ b/compatibility/2.3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # 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 b770840..1a7c9c3 100644 --- a/compatibility/2.4.nom +++ b/compatibility/2.4.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # 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 a3f8b27..efed78d 100644 --- a/compatibility/2.5.5.5.nom +++ b/compatibility/2.5.5.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # 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 fe17dfb..b1e01b0 100644 --- a/compatibility/2.5.nom +++ b/compatibility/2.5.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu <2.5 to Nomsu 2.5 diff --git a/compatibility/2.nom b/compatibility/2.nom index 2364f56..d7a1489 100644 --- a/compatibility/2.nom +++ b/compatibility/2.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu 1 to Nomsu 2 diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom index 068e65d..89fbc8a 100644 --- a/compatibility/3.5.5.6.nom +++ b/compatibility/3.5.5.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # 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 eec97eb..7cd5c64 100644 --- a/compatibility/3.6.nom +++ b/compatibility/3.6.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu <3.6 to 3.6 diff --git a/compatibility/3.7.nom b/compatibility/3.7.nom index 5b458de..599e0d5 100644 --- a/compatibility/3.7.nom +++ b/compatibility/3.7.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu <3.7 to 3.7 diff --git a/compatibility/3.8.nom b/compatibility/3.8.nom index 9538770..0709688 100644 --- a/compatibility/3.8.nom +++ b/compatibility/3.8.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu <3.8 to 3.8 (Text method changes) diff --git a/compatibility/3.nom b/compatibility/3.nom index 36df17d..5156aa8 100644 --- a/compatibility/3.nom +++ b/compatibility/3.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V4.8.8.6 +#!/usr/bin/env nomsu -V4.8.10 # This file defines upgrades from Nomsu <=2 to Nomsu 3 diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom index 58fd376..d20448e 100644 --- a/compatibility/4.8.10.nom +++ b/compatibility/4.8.10.nom @@ -56,4 +56,4 @@ upgrade action "parse 1 as 2" to "4.8.10" via (..) return \(%spec parse as %body) upgrade action (compile as %) to "4.8.10" as (what % compiles to) - +upgrade action (action %) to "4.8.10" as (%'s meaning) diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index 6da7063..c61b5a9 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -80,16 +80,15 @@ externally [..] %tree with % -> (..) if ((% is "Action" syntax tree) and %ACTION_UPGRADES.%ver.(%.stub)): %with_upgraded_args = (..) - %k = (%v upgraded from %start_version to %end_version) \ - ..for %k = %v in % - set %with_upgraded_args's metatable to (%'s metatable) - return (call %ACTION_UPGRADES.%ver.(%.stub) with [%with_upgraded_args, %end_version]) + %k = (%v upgraded from %start_version to %end_version) for %k = %v in % + set %with_upgraded_args 's metatable to (% 's metatable) + return (..) + call %ACTION_UPGRADES.%ver.(%.stub) with [%with_upgraded_args, %end_version] if %UPGRADES.%ver: %with_upgraded_args = (..) - %k = (%v upgraded from %start_version to %end_version) \ - ..for %k = %v in %tree - set %with_upgraded_args's metatable to (%tree's metatable) + %k = (%v upgraded from %start_version to %end_version) for %k = %v in %tree + set %with_upgraded_args 's metatable to (%tree 's metatable) %tree = (call %UPGRADES.%ver with [%with_upgraded_args, %end_version]) return %tree -- cgit v1.2.3 From 307dea18815ba4a06a3098edb170d7ad90708815 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 2 Nov 2018 14:38:24 -0700 Subject: Changed stub convention to (foo 1 baz 2) -> foo_1_baz instead of foo_1_baz_2, removed "smext", made some cleanup changes. --- compatibility/4.8.10.nom | 1 + compatibility/compatibility.nom | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'compatibility') diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom index d20448e..66152b5 100644 --- a/compatibility/4.8.10.nom +++ b/compatibility/4.8.10.nom @@ -57,3 +57,4 @@ upgrade action "parse 1 as 2" to "4.8.10" via (..) upgrade action (compile as %) to "4.8.10" as (what % compiles to) upgrade action (action %) to "4.8.10" as (%'s meaning) +upgrade action (remove action %) to "4.8.10" as ((%'s meaning) = (nil)) diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index c61b5a9..1153ab4 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -52,7 +52,7 @@ externally (upgrade action %stub to %version via %upgrade_fn) means: %retval = (make tree %body) %lua::append (..) Lua "\ - ..upgrade_action_1_to_2_via_3(\(quote %action.stub), \(%version as lua expr), function(\(..) + ..upgrade_action_1_to_2_via(\(quote %action.stub), \(%version as lua expr), function(\(..) \%tree as lua id ..) return \%retval -- cgit v1.2.3