From 652c29bdef1f0991cc13bef59d6dc78b657ae9a4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 8 Nov 2018 15:23:22 -0800 Subject: Major overhaul, splitting nomsu_compiler into nomsu_environment, nomsu_compiler, and nomsu_decompiler. Also added comprehensions. --- 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.nom | 2 ++ compatibility/4.8.10.nom | 2 ++ compatibility/4.9.nom | 61 +++++++++++++++++++++++++++++++++++++++++ compatibility/compatibility.nom | 2 ++ 12 files changed, 83 insertions(+) create mode 100644 compatibility/4.9.nom (limited to 'compatibility') diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom index 7de353e..df3c619 100644 --- a/compatibility/2.3.nom +++ b/compatibility/2.3.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action (%a = %b) to "2.3" as (%a == %b) upgrade action (<- %) to "2.3" as (set %) upgrade action (assign %) to "2.3" as (set %) diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom index 1a7c9c3..f26bf0d 100644 --- a/compatibility/2.4.nom +++ b/compatibility/2.4.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade %tree to "2.4" as: unless (%tree is "Action" syntax tree): return if %tree.stub is: diff --git a/compatibility/2.5.5.5.nom b/compatibility/2.5.5.5.nom index efed78d..b7a7b21 100644 --- a/compatibility/2.5.5.5.nom +++ b/compatibility/2.5.5.5.nom @@ -4,6 +4,8 @@ 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)" diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom index b1e01b0..8c3f4d0 100644 --- a/compatibility/2.5.nom +++ b/compatibility/2.5.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action (for %1 where %2 matches %3 %4) to "2.5" as (..) for %1 in %2 matching %3 %4 diff --git a/compatibility/2.nom b/compatibility/2.nom index d7a1489..eb4060a 100644 --- a/compatibility/2.nom +++ b/compatibility/2.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade %tree to "2" as: unless (%tree is "Action" syntax tree): return if (%tree.stub is "if % % else %"): diff --git a/compatibility/3.5.5.6.nom b/compatibility/3.5.5.6.nom index 89fbc8a..ff69614 100644 --- a/compatibility/3.5.5.6.nom +++ b/compatibility/3.5.5.6.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action "traceback" to "3.5.5.6" via (..) [%] -> (barf "'traceback' has been deprecated") diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom index 7cd5c64..b2fc5b4 100644 --- a/compatibility/3.6.nom +++ b/compatibility/3.6.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action [..] append %item to %list, add %item to %list, to %list add %item, to %list append %item ..to "3.6" as (%list::add %item) diff --git a/compatibility/3.7.nom b/compatibility/3.7.nom index 599e0d5..76a49e2 100644 --- a/compatibility/3.7.nom +++ b/compatibility/3.7.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action [%index st to last in %list] to "3.7" as (%list::%index st to last) upgrade action [%index nd to last in %list] to "3.7" as (%list::%index nd to last) upgrade action [%index rd to last in %list] to "3.7" as (%list::%index rd to last) diff --git a/compatibility/3.nom b/compatibility/3.nom index 5156aa8..a4840ca 100644 --- a/compatibility/3.nom +++ b/compatibility/3.nom @@ -4,6 +4,8 @@ use "compatibility/compatibility.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + upgrade action (method %spec %body) to "3" as (my action %spec %body) upgrade action (me) to "3" as %me upgrade action (@) to "3" as %me diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom index 66152b5..d62efa1 100644 --- a/compatibility/4.8.10.nom +++ b/compatibility/4.8.10.nom @@ -3,6 +3,8 @@ 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 diff --git a/compatibility/4.9.nom b/compatibility/4.9.nom new file mode 100644 index 0000000..f84171a --- /dev/null +++ b/compatibility/4.9.nom @@ -0,0 +1,61 @@ +#!/usr/bin/env nomsu -V4.9.11.6 +# + This file defines upgrades from Nomsu <4.9 to 4.9 +use "compatibility/compatibility.nom" + +upgrade action "local action 1 2" to "4.9" 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.9" 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.9" 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.9" 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.9" as (what % compiles to) +upgrade action (action %) to "4.9" as (%'s meaning) +upgrade action (remove action %) to "4.9" as ((%'s meaning) = (nil)) +upgrade action (if %) to "4.9" as (when %) diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index 1153ab4..184ca56 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -5,6 +5,8 @@ use "lib/os.nom" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + %UPGRADES = {} externally (upgrade to %version via %upgrade_fn) means: %UPGRADES.%version = %upgrade_fn -- cgit v1.2.3