aboutsummaryrefslogtreecommitdiff
path: root/compatibility
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-22 15:01:05 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-22 15:01:05 -0700
commitaddac10a47693a976808bf75fe63aed19f8dbb63 (patch)
treeb072998c987f86eb1ecd381fd36eee0d1e3a6091 /compatibility
parent4fa9757fa27d79a0cda399dcf3b711f4d0d60457 (diff)
Re-autoformatted everything. The main changes are: no longer adding a
newline after 1-line indented code inside blocks, and forcing files to have a trailing newline. The trailing newline thing created a lot of spurious changes.
Diffstat (limited to 'compatibility')
-rw-r--r--compatibility/2.3.nom2
-rw-r--r--compatibility/2.4.nom15
-rw-r--r--compatibility/2.5.nom2
-rw-r--r--compatibility/2.nom4
-rw-r--r--compatibility/compatibility.nom5
5 files changed, 5 insertions, 23 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index 7b49a26..46ce6a0 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -13,4 +13,4 @@ upgrade action (%a *<- %b) to "2.3" as (%a *= %b)
upgrade action (%a /<- %b) to "2.3" as (%a /= %b)
upgrade action (%a ^<- %b) to "2.3" as (%a ^= %b)
upgrade action (%a and<- %b) to "2.3" as (%a and= %b)
-upgrade action (%a or<- %b) to "2.3" as (%a or= %b) \ No newline at end of file
+upgrade action (%a or<- %b) to "2.3" as (%a or= %b)
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index 479d1d2..958c6bf 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -10,30 +10,23 @@ upgrade %tree to "2.4" as:
%new_lines = []
%body = (..)
(%tree.2 upgraded) if (%tree.2 is "Block" syntax tree) else [%tree.2 upgraded]
-
for %line in %body:
if:
(not (%line is syntax tree)):
compile error at %tree.source "WUT: %s"
-
(not (%line is "Action" syntax tree)):
add %line to %new_lines
-
(%line.stub is "* %"):
add %line.2 to %conditions
-
(%line.stub == "* else %"):
add (\(else %block) with vars {block:%line.3}) to %new_lines
-
(%line.stub != "* % %"):
add %line to %new_lines
-
else:
add %line.2 to %conditions
%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 = []
@@ -46,31 +39,25 @@ upgrade %tree to "2.4" as:
%new_lines = []
%body = (..)
(%tree.5 upgraded) if (%tree.5 is "Block" syntax tree) else [%tree.5 upgraded]
-
for %line in %body:
if:
(not (%line is "Action" syntax tree)):
add %line to %new_lines
-
(%line.stub is "* %"):
add %line.2 to %values
-
(%line.stub == "* else %"):
add (\(else %block) with vars {block:%line.3}) to %new_lines
-
(%line.stub != "* % %"):
add %line to %new_lines
-
else:
add %line.2 to %values
%action = %line.3
unless (%action is "Block" syntax tree):
%action = (=lua "Block(\%action.source, \%action)")
-
add %action to %values
add (=lua "Action(\%values[1].source, unpack(\%values))") to %new_lines
%values = []
return (..)
\(if %var is %body) with vars {..}
- var:%tree.2 upgraded, body:=lua "Block(\%tree[5].source, unpack(\%new_lines))" \ No newline at end of file
+ var:%tree.2 upgraded, body:=lua "Block(\%tree[5].source, unpack(\%new_lines))"
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index b2786f4..118c13e 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -6,4 +6,4 @@ upgrade action (for %1 where %2 matches %3 %4) to "2.5" as (..)
for %1 in %2 matching %3 %4
upgrade action (%1 for %2 where %3 matches %4) to "2.5" as (..)
- %1 for %2 in %3 matching %4 \ No newline at end of file
+ %1 for %2 in %3 matching %4
diff --git a/compatibility/2.nom b/compatibility/2.nom
index 36917b1..a7a3afe 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -8,11 +8,9 @@ upgrade %tree to "2" as:
%true_body = (%tree.3 upgraded)
unless (%true_body is "Block" syntax tree):
%true_body = (=lua "Block(\%true_body.source, \%true_body)")
-
%false_body = (%tree.5 upgraded)
unless (%false_body is "Block" syntax tree):
%false_body = (=lua "Block(\%false_body.source, \%false_body)")
-
return (..)
\(if %cond %true_body else %false_body) with vars {..}
cond:%tree.2 upgraded, true_body:%true_body, false_body:%false_body
@@ -30,4 +28,4 @@ upgrade %tree to "2" as:
%body = (last in %bits)
%bits.(length of %bits) = (=lua "Block(\%body.source, \%body)")
- return (=lua "Action(\%tree.source, unpack(\%bits))") \ No newline at end of file
+ return (=lua "Action(\%tree.source, unpack(\%bits))")
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index 109b4e9..b936efb 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -10,7 +10,6 @@ action [upgrade to %version via %upgrade_fn]:
action [upgrade action %stub to %version via %upgrade_fn]:
unless %ACTION_UPGRADES.%version:
%ACTION_UPGRADES.%version = []
-
%ACTION_UPGRADES.%version.%stub = %upgrade_fn
parse [upgrade %tree to %version as %body] as (..)
@@ -58,10 +57,8 @@ action [..]
%versions = {}
for %v = % in %UPGRADES:
%versions.%v = (yes)
-
for %v = % in %ACTION_UPGRADES:
%versions.%v = (yes)
-
%versions = ((keys in %versions) sorted by % -> (% as list))
for %ver in %versions:
if ((%ver as list) <= (%start_version as list)): do next %ver
@@ -94,4 +91,4 @@ action [use %path from version %version] (..)
%file = (read file %filename)
%tree = (parse %file from %filename)
%tree = (upgrade %tree from %version)
- run tree %tree \ No newline at end of file
+ run tree %tree