diff options
author | Undecidable Robot <undecidabot@gmail.com> | 2016-05-24 13:03:21 +0800 |
---|---|---|
committer | Undecidable Robot <undecidabot@gmail.com> | 2016-05-24 13:29:36 +0800 |
commit | c904c47fab8d06e2bfe91ae852e95b41d6e309e1 (patch) | |
tree | f539e8c9cc740434254ae6c1f2d6dc27ef35b57c | |
parent | d181b96c772df1faebcd8b4bf8fdc835727af6ba (diff) | |
download | lpeglabel-c904c47fab8d06e2bfe91ae852e95b41d6e309e1.tar.gz lpeglabel-c904c47fab8d06e2bfe91ae852e95b41d6e309e1.tar.bz2 lpeglabel-c904c47fab8d06e2bfe91ae852e95b41d6e309e1.zip |
Renaming a few rules for clarity
-rw-r--r-- | relabel.lua | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/relabel.lua b/relabel.lua index 8e45ec1..76846ff 100644 --- a/relabel.lua +++ b/relabel.lua | |||
@@ -277,28 +277,29 @@ local labelset3 = labify { | |||
277 | 277 | ||
278 | local exp = m.P{ "Exp", | 278 | local exp = m.P{ "Exp", |
279 | Exp = S * ( m.V"Grammar" | 279 | Exp = S * ( m.V"Grammar" |
280 | + (m.V"SeqLC" * (S * "/" * m.Lc((m.Ct(m.V"Labels") + m.Cc(nil)) | 280 | + (m.V"RecovSeq" * (S * "/" * m.Lc((m.Ct(m.V"Labels") + m.Cc(nil)) |
281 | * expect(S * m.V"SeqLC", "ExpPatt1"), | 281 | * expect(S * m.V"RecovSeq", |
282 | m.Cc(nil) * m.V"Skip", | 282 | "ExpPatt1"), |
283 | unpack(labelset3)) | 283 | m.Cc(nil) * m.V"Skip", |
284 | unpack(labelset3)) | ||
284 | )^0 | 285 | )^0 |
285 | ) / labchoice); | 286 | ) / labchoice); |
286 | Labels = m.P"{" * expect(S * m.V"Label", "ExpLab1") | 287 | Labels = m.P"{" * expect(S * m.V"Label", "ExpLab1") |
287 | * (S * "," * expect(S * m.V"Label", "ExpLab2"))^0 | 288 | * (S * "," * expect(S * m.V"Label", "ExpLab2"))^0 |
288 | * expect(S * "}", "MisClose7"); | 289 | * expect(S * "}", "MisClose7"); |
289 | Skip = (-m.P"/" * -m.P(name * arrow) * m.V"Stuff")^0 * m.Cc(dummy); | 290 | Skip = (-m.P"/" * -m.P(name * arrow) * m.V"Ignored")^0 * m.Cc(dummy); |
290 | Stuff = m.V"Group" + any; | 291 | Ignored = m.V"Group" + any; |
291 | Group = "(" * (-m.P")" * m.V"Stuff")^0 * ")" | 292 | Group = "(" * (-m.P")" * m.V"Ignored")^0 * ")" |
292 | + "{" * (-m.P"}" * m.V"Stuff")^0 * "}" | 293 | + "{" * (-m.P"}" * m.V"Ignored")^0 * "}" |
293 | + "[" * (-m.P"]" * m.V"Stuff")^0 * "]" | 294 | + "[" * (-m.P"]" * m.V"Ignored")^0 * "]" |
294 | + "'" * (-m.P"'" * m.V"Stuff")^0 * "'" | 295 | + "'" * (-m.P"'" * m.V"Ignored")^0 * "'" |
295 | + '"' * (-m.P'"' * m.V"Stuff")^0 * '"'; | 296 | + '"' * (-m.P'"' * m.V"Ignored")^0 * '"'; |
296 | SeqLC = m.Lc(m.V"Seq", m.V"Skip", unpack(labelset1)); | 297 | RecovSeq = m.Lc(m.V"Seq", m.V"Skip", unpack(labelset1)); |
297 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix" * (S * m.V"Prefix")^0, mt.__mul); | 298 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix" * (S * m.V"Prefix")^0, mt.__mul); |
298 | Prefix = "&" * expect(S * m.V"Prefix", "ExpPatt2") / mt.__len | 299 | Prefix = "&" * expect(S * m.V"Prefix", "ExpPatt2") / mt.__len |
299 | + "!" * expect(S * m.V"Prefix", "ExpPatt3") / mt.__unm | 300 | + "!" * expect(S * m.V"Prefix", "ExpPatt3") / mt.__unm |
300 | + m.V"Suffix"; | 301 | + m.V"Suffix"; |
301 | Suffix = m.Cf(m.V"PrimaryLC" * | 302 | Suffix = m.Cf(m.V"RecovPrimary" * |
302 | ( S * ( m.P"+" * m.Cc(1, mt.__pow) | 303 | ( S * ( m.P"+" * m.Cc(1, mt.__pow) |
303 | + m.P"*" * m.Cc(0, mt.__pow) | 304 | + m.P"*" * m.Cc(0, mt.__pow) |
304 | + m.P"?" * m.Cc(-1, mt.__pow) | 305 | + m.P"?" * m.Cc(-1, mt.__pow) |
@@ -315,7 +316,7 @@ local exp = m.P{ "Exp", | |||
315 | "ExpName1") | 316 | "ExpName1") |
316 | ) | 317 | ) |
317 | )^0, function (a,b,f) return f(a,b) end ); | 318 | )^0, function (a,b,f) return f(a,b) end ); |
318 | PrimaryLC = m.Lc(m.V"Primary", ignore, unpack(labelset2)); | 319 | RecovPrimary = m.Lc(m.V"Primary", ignore, unpack(labelset2)); |
319 | Primary = "(" * expect(m.V"Exp", "ExpPatt4") * expect(S * ")", "MisClose1") | 320 | Primary = "(" * expect(m.V"Exp", "ExpPatt4") * expect(S * ")", "MisClose1") |
320 | + m.Lc(String / mm.P, pointAtStart, | 321 | + m.Lc(String / mm.P, pointAtStart, |
321 | labels["MisTerm1"], labels["MisTerm2"]) | 322 | labels["MisTerm1"], labels["MisTerm2"]) |