aboutsummaryrefslogtreecommitdiff
path: root/compatibility
diff options
context:
space:
mode:
Diffstat (limited to 'compatibility')
-rw-r--r--compatibility/2.4.nom34
-rw-r--r--compatibility/2.nom10
-rw-r--r--compatibility/3.nom4
-rw-r--r--compatibility/4.8.10.nom28
-rw-r--r--compatibility/4.9.nom28
-rw-r--r--compatibility/compatibility.nom4
6 files changed, 56 insertions, 52 deletions
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index f26bf0d..1f87a98 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -9,23 +9,22 @@ use "compatibility/compatibility.nom"
upgrade %tree to "2.4" as:
unless (%tree is "Action" syntax tree): return
if %tree.stub is:
- "when %":
+ "when":
%conditions = []
%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"
+ when:
(not (%line is "Action" syntax tree)):
%new_lines::add %line
- (%line.stub is "* %"):
- %conditions::add %line.2
- (%line.stub == "* else %"):
+ (%line.stub is "*"):
+ if ((size of %line) == 2):
+ %conditions::add %line.2
+ ..else:
+ %new_lines::add %line
+ (%line.stub == "* else"):
%new_lines::add (\(else %block) with vars {block:%line.3})
- (%line.stub != "* % %"):
- %new_lines::add %line
else:
%conditions::add %line.2
%action = %line.3
@@ -36,23 +35,24 @@ upgrade %tree to "2.4" as:
%conditions = []
return (..)
- \(if %body) with vars {body:=lua "Block(\%tree[2].source, unpack(\%new_lines))"}
+ \(when %body) with vars {body:=lua "Block(\%tree[2].source, unpack(\%new_lines))"}
- "when % is ? %" "when % = ? %":
+ "when 1 is ?" "when 1 = ?":
%values = []
%new_lines = []
%body = (..)
(%tree.5 upgraded) if (%tree.5 is "Block" syntax tree) else [%tree.5 upgraded]
for %line in %body:
- if:
+ when:
(not (%line is "Action" syntax tree)):
%new_lines::add %line
- (%line.stub is "* %"):
- %values::add %line.2
- (%line.stub == "* else %"):
+ (%line.stub is "*"):
+ if ((size of %line) == 2):
+ %values::add %line.2
+ ..else:
+ %new_lines::add %line
+ (%line.stub == "* else"):
%new_lines::add (\(else %block) with vars {block:%line.3})
- (%line.stub != "* % %"):
- %new_lines::add %line
else:
%values::add %line.2
%action = %line.3
diff --git a/compatibility/2.nom b/compatibility/2.nom
index eb4060a..5c78e29 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -8,7 +8,7 @@ use "compatibility/compatibility.nom"
upgrade %tree to "2" as:
unless (%tree is "Action" syntax tree): return
- if (%tree.stub is "if % % else %"):
+ if (%tree.stub is "if 1 2 else"):
%true_body = (%tree.3 upgraded)
unless (%true_body is "Block" syntax tree):
%true_body = \(: %true_body)
@@ -20,10 +20,10 @@ upgrade %tree to "2" as:
cond:%tree.2 upgraded, true_body:%true_body, false_body:%false_body
%need_blocks = [..]
- "if % %", "unless % %", "for % in % %", "for % = % in % %", "repeat while % %"
- "repeat % times %", "repeat %", "repeat until % %", "for % in % to % by % %"
- "for % in % to % via % %", "for % in % to % %", "for % % in % %"
- "do %", "for % in recursive % %", "test %", "with % %", "result of %"
+ "if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1"
+ "repeat 1 times", "repeat", "repeat until 1", "for 1 in 2 to 3 by"
+ "for 1 in 2 to 3 via", "for 1 in 2 to", "for 1 2 in"
+ "do", "for 1 in recursive", "test", "with", "result of"
for %n in %need_blocks:
if (%tree.stub is %n):
diff --git a/compatibility/3.nom b/compatibility/3.nom
index a4840ca..f97bb8b 100644
--- a/compatibility/3.nom
+++ b/compatibility/3.nom
@@ -9,7 +9,7 @@ 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
-upgrade action "as 1 2" to "3" via (..)
+upgrade action "as" to "3" via (..)
[] -> (..)
barf "\
- ..Object API has changed. Use (%obj::action 1 2) instead of (as %obj: action 1 2)"
+ ..Object API has changed. Use (%obj::action ...) instead of (as %obj: action ...)"
diff --git a/compatibility/4.8.10.nom b/compatibility/4.8.10.nom
index d62efa1..7ea95b0 100644
--- a/compatibility/4.8.10.nom
+++ b/compatibility/4.8.10.nom
@@ -5,7 +5,7 @@ use "compatibility/compatibility.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-upgrade action "local action 1 2" to "4.8.10" via (..)
+upgrade action "local action" to "4.8.10" via (..)
[%tree, %end_version] ->:
%spec = %tree.3
%body = %tree.4
@@ -18,20 +18,23 @@ upgrade action "local action 1 2" to "4.8.10" via (..)
else:
return \(%spec means %body)
-upgrade action "action 1 2" to "4.8.10" via (..)
+upgrade action "action" 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)
+ if %body:
+ 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)
+ ..else:
+ return \(%spec's meaning)
-upgrade action "compile 1 to 2" to "4.8.10" via (..)
+upgrade action "compile 1 to" to "4.8.10" via (..)
[%tree, %end_version] ->:
%spec = %tree.2
%body = %tree.4
@@ -44,7 +47,7 @@ upgrade action "compile 1 to 2" to "4.8.10" via (..)
else:
return \(%spec compiles to %body)
-upgrade action "parse 1 as 2" to "4.8.10" via (..)
+upgrade action "parse 1 as" to "4.8.10" via (..)
[%tree, %end_version] ->:
%spec = %tree.2
%body = %tree.4
@@ -58,5 +61,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)
upgrade action (remove action %) to "4.8.10" as ((%'s meaning) = (nil))
diff --git a/compatibility/4.9.nom b/compatibility/4.9.nom
index f84171a..7eb54d4 100644
--- a/compatibility/4.9.nom
+++ b/compatibility/4.9.nom
@@ -3,7 +3,7 @@
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 (..)
+upgrade action "local action" to "4.9" via (..)
[%tree, %end_version] ->:
%spec = %tree.3
%body = %tree.4
@@ -16,20 +16,23 @@ upgrade action "local action 1 2" to "4.9" via (..)
else:
return \(%spec means %body)
-upgrade action "action 1 2" to "4.9" via (..)
+upgrade action "action" 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)
+ if %body:
+ 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)
+ ..else:
+ return \(%spec's meaning)
-upgrade action "compile 1 to 2" to "4.9" via (..)
+upgrade action "compile 1 to" to "4.9" via (..)
[%tree, %end_version] ->:
%spec = %tree.2
%body = %tree.4
@@ -42,7 +45,7 @@ upgrade action "compile 1 to 2" to "4.9" via (..)
else:
return \(%spec compiles to %body)
-upgrade action "parse 1 as 2" to "4.9" via (..)
+upgrade action "parse 1 as" to "4.9" via (..)
[%tree, %end_version] ->:
%spec = %tree.2
%body = %tree.4
@@ -56,6 +59,5 @@ upgrade action "parse 1 as 2" to "4.9" via (..)
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 4e22dbc..09eacc2 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -36,7 +36,7 @@ externally (upgrade action %stub to %version via %upgrade_fn) means:
return %replacements.(%t.1)
..else:
external %needs_mangle = (yes)
- return "\(%t.type){source=\(quote "\(%t.source)"), \(quote (mangle %t.1))}"
+ return "SyntaxTree{type=\(quote %t.type), source=\(quote "\(%t.source)"), \(quote (mangle %t.1))}"
(%t is syntax tree):
%args = []
@@ -46,7 +46,7 @@ externally (upgrade action %stub to %version via %upgrade_fn) means:
..else:
%args::add "\(%k)=\(make tree %v)"
- return "\(%t.type){\(%args::joined with ", ")}"
+ return "SyntaxTree{\(%args::joined with ", ")}"
else: return (quote %t)