diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-08-29 15:59:30 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-08-29 16:00:04 -0700 |
| commit | 811fdd685670d2eb8c6bcb9e6e103e57bf402ca8 (patch) | |
| tree | c599fd7a609159c2ec50a30f1131000070e8eb03 /compatibility | |
| parent | 22495c7d708b4950b83c5bc9b97806e19cd1fcfa (diff) | |
Tweaked version 3.6 to include deprecating list append/removal functions
in favor of using a method call style.
Diffstat (limited to 'compatibility')
| -rw-r--r-- | compatibility/2.4.nom | 28 | ||||
| -rw-r--r-- | compatibility/3.6.nom | 24 | ||||
| -rw-r--r-- | compatibility/compatibility.nom | 4 |
3 files changed, 33 insertions, 23 deletions
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom index 2207343..4b416fb 100644 --- a/compatibility/2.4.nom +++ b/compatibility/2.4.nom @@ -17,20 +17,20 @@ upgrade %tree to "2.4" as: (not (%line is syntax tree)): compile error at %tree.source "WUT: %s" (not (%line is "Action" syntax tree)): - add %line to %new_lines + %new_lines::add %line (%line.stub is "* %"): - add %line.2 to %conditions + %conditions::add %line.2 (%line.stub == "* else %"): - add (\(else %block) with vars {block:%line.3}) to %new_lines + %new_lines::add (\(else %block) with vars {block:%line.3}) (%line.stub != "* % %"): - add %line to %new_lines + %new_lines::add %line else: - add %line.2 to %conditions + %conditions::add %line.2 %action = %line.3 unless (%action is "Block" syntax tree): %action = (=lua "Block(\%action.source, \%action)") - add %action to %conditions - add (=lua "Action(\%conditions[1].source, unpack(\%conditions))") to %new_lines + %conditions::add %action + %new_lines::add (=lua "Action(\%conditions[1].source, unpack(\%conditions))") %conditions = [] return (..) @@ -44,20 +44,20 @@ upgrade %tree to "2.4" as: for %line in %body: if: (not (%line is "Action" syntax tree)): - add %line to %new_lines + %new_lines::add %line (%line.stub is "* %"): - add %line.2 to %values + %values::add %line.2 (%line.stub == "* else %"): - add (\(else %block) with vars {block:%line.3}) to %new_lines + %new_lines::add (\(else %block) with vars {block:%line.3}) (%line.stub != "* % %"): - add %line to %new_lines + %new_lines::add %line else: - add %line.2 to %values + %values::add %line.2 %action = %line.3 unless (%action is "Block" syntax tree): %action = \(: %action) - add %action to %values - add (=lua "Action(\%values[1].source, unpack(\%values))") to %new_lines + %values::add %action + %new_lines::add (=lua "Action(\%values[1].source, unpack(\%values))") %values = [] return (..) diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom index 297612a..ecf4fb3 100644 --- a/compatibility/3.6.nom +++ b/compatibility/3.6.nom @@ -4,17 +4,27 @@ use "compatibility/compatibility.nom" -upgrade action (to %1 write %2) to "3.6" as (%1::append %2) -upgrade action (%1 <-write %2) to "3.6" as (%1::append %2) -upgrade action (to %1 write %2 joined by %3) to "3.6" as (..) +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) + +upgrade action [add %item to %list at index %i] to "3.6" as (..) + %list::at index %i add %item + +upgrade action [pop from %list, remove last from %list] to "3.6" as (%list::pop) +upgrade action [remove index %index from %list] to "3.6" as (..) + %list::remove index %index + +upgrade action [to %1 write %2, %1 <-write %2] to "3.6" as (%1::append %2) +upgrade action [to %1 write %2 joined by %3] to "3.6" as (..) %1::append %2 joined by %3 -upgrade action (declare locals in %lua) to "3.6" as (%lua::declare locals) -upgrade action (declare locals %locs in %lua) to "3.6" as (..) +upgrade action [declare locals in %lua] to "3.6" as (%lua::declare locals) +upgrade action [declare locals %locs in %lua] to "3.6" as (..) %lua::declare locals %locs -upgrade action (add free vars %vars to %lua) to "3.6" as (..) +upgrade action [add free vars %vars to %lua] to "3.6" as (..) %lua::add free vars %vars -upgrade action (remove free vars %vars from %lua) to "3.6" as (..) +upgrade action [remove free vars %vars from %lua] to "3.6" as (..) %lua::remove free vars %vars diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom index d74cabe..d63383b 100644 --- a/compatibility/compatibility.nom +++ b/compatibility/compatibility.nom @@ -39,9 +39,9 @@ compile [upgrade action %actions to %version as %body] to: (%t is syntax tree): %args = ((make tree %) for % in %t) - add "source=\(\%tree as lua id).source" to %args at index 1 + %args::add "source=\(\%tree as lua id).source" if %t.target: - add "target=\(make tree %t.target)" to %args at index 1 + %args::add "target=\(make tree %t.target)" return "\(%t.type){\(%args joined with ", ")}" else: |
