aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUndecidable Robot <undecidabot@gmail.com>2016-05-16 20:23:59 +0800
committerUndecidable Robot <undecidabot@gmail.com>2016-05-16 20:30:31 +0800
commit2c9d40dc6a23a55f6c67b59735606e3511a2c6ad (patch)
tree0508b05abfc09d32013b0c4d5c6617dcc2845408
parent025e0c375de5fca0b220d66d3e1f59837a020137 (diff)
downloadlpeglabel-2c9d40dc6a23a55f6c67b59735606e3511a2c6ad.tar.gz
lpeglabel-2c9d40dc6a23a55f6c67b59735606e3511a2c6ad.tar.bz2
lpeglabel-2c9d40dc6a23a55f6c67b59735606e3511a2c6ad.zip
Fixing odd bug in the unification of ordered and labled choice
-rw-r--r--relabel.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/relabel.lua b/relabel.lua
index ed3a6ed..7055eaa 100644
--- a/relabel.lua
+++ b/relabel.lua
@@ -179,7 +179,7 @@ local function labchoice (...)
179 local p = t[1] 179 local p = t[1]
180 local i = 2 180 local i = 2
181 while i + 1 <= n do 181 while i + 1 <= n do
182 p = mm.Lc(p, t[i+1], unpack(t[i])) 182 p = t[i] and mm.Lc(p, t[i+1], unpack(t[i])) or mt.__add(p, t[i+1])
183 i = i + 2 183 i = i + 2
184 end 184 end
185 185
@@ -188,7 +188,7 @@ end
188 188
189local exp = m.P{ "Exp", 189local exp = m.P{ "Exp",
190 Exp = S * ( m.V"Grammar" 190 Exp = S * ( m.V"Grammar"
191 + (m.V"Seq" * ("/" * (m.V"Labels" + m.Cc({0})) * S 191 + (m.V"Seq" * ("/" * (m.V"Labels" + m.Cc(nil)) * S
192 * m.Lc(m.V"Seq" + throw(4), (-m.P"/" * any)^0, 4, 5, 6, 7, 8, 9, 10))^0) / labchoice ); 192 * m.Lc(m.V"Seq" + throw(4), (-m.P"/" * any)^0, 4, 5, 6, 7, 8, 9, 10))^0) / labchoice );
193 Labels = m.Ct(m.P"{" * S * (m.V"Label" + throw(27)) * (S * "," * S * (m.V"Label" + throw(28)))^0 * S * ("}" + throw(29))); 193 Labels = m.Ct(m.P"{" * S * (m.V"Label" + throw(27)) * (S * "," * S * (m.V"Label" + throw(28)))^0 * S * ("}" + throw(29)));
194 Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul); 194 Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul);