From 9a75d25c843b03e3671b71384fd48deb0607db43 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Nov 2018 15:05:18 -0800 Subject: Lots of fixes to the upgrading and codegen/autoformatting pipeline, also deleted nomnom files, since they're mostly not needed anymore. --- compatibility/2.4.nom | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'compatibility/2.4.nom') diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom index 1f87a98..2b39dd5 100644 --- a/compatibility/2.4.nom +++ b/compatibility/2.4.nom @@ -9,7 +9,9 @@ use "compatibility/compatibility.nom" upgrade %tree to "2.4" as: unless (%tree is "Action" syntax tree): return if %tree.stub is: - "when": + "when" "if": + if ((size of %tree) == 3): + return %tree %conditions = [] %new_lines = [] %body = (..) @@ -29,15 +31,15 @@ upgrade %tree to "2.4" as: %conditions::add %line.2 %action = %line.3 unless (%action is "Block" syntax tree): - %action = (=lua "Block(\%action.source, \%action)") + %action = (=lua "SyntaxTree{type='Block', source=\%action.source, \%action}") %conditions::add %action - %new_lines::add (=lua "Action(\%conditions[1].source, unpack(\%conditions))") + %new_lines::add (=lua "SyntaxTree{type='Action', source=\%conditions[1].source, unpack(\%conditions)}") %conditions = [] return (..) - \(when %body) with vars {body:=lua "Block(\%tree[2].source, unpack(\%new_lines))"} + \(when %body) with vars {body:=lua "SyntaxTree{type='Block', source=\%tree[2].source, unpack(\%new_lines)}"} - "when 1 is ?" "when 1 = ?": + "if 1 is ?" "if 1 = ?": %values = [] %new_lines = [] %body = (..) @@ -59,9 +61,9 @@ upgrade %tree to "2.4" as: unless (%action is "Block" syntax tree): %action = \(: %action) %values::add %action - %new_lines::add (=lua "Action(\%values[1].source, unpack(\%values))") + %new_lines::add (=lua "SyntaxTree{type='Action', source=\%values[1].source, unpack(\%values)}") %values = [] return (..) \(if %var is %body) with vars {..} - var:%tree.2 upgraded, body:=lua "Block(\%tree[5].source, unpack(\%new_lines))" + var:%tree.2 upgraded, body:=lua "SyntaxTree{type='Block', source=\%tree[5].source, unpack(\%new_lines)}" -- cgit v1.2.3