diff options
author | Undecidable Robot <undecidabot@gmail.com> | 2016-05-16 21:00:02 +0800 |
---|---|---|
committer | Undecidable Robot <undecidabot@gmail.com> | 2016-05-16 21:00:02 +0800 |
commit | 977213610df9ca3065de4ae60c7cf012c46f2834 (patch) | |
tree | e6ac723d3dd19f24570805ae3fd584500953df1c /relabel.lua | |
parent | 2c9d40dc6a23a55f6c67b59735606e3511a2c6ad (diff) | |
download | lpeglabel-977213610df9ca3065de4ae60c7cf012c46f2834.tar.gz lpeglabel-977213610df9ca3065de4ae60c7cf012c46f2834.tar.bz2 lpeglabel-977213610df9ca3065de4ae60c7cf012c46f2834.zip |
Making skips in error recovery more intelligent
Diffstat (limited to 'relabel.lua')
-rw-r--r-- | relabel.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/relabel.lua b/relabel.lua index 7055eaa..e3b7d48 100644 --- a/relabel.lua +++ b/relabel.lua | |||
@@ -188,9 +188,14 @@ end | |||
188 | 188 | ||
189 | local exp = m.P{ "Exp", | 189 | local 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(nil)) * S | 191 | + (m.V"SeqLC" * ("/" * (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"SeqLC" + throw(4), m.V"SkipToSlash", 4))^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 | SkipToSlash = (-m.P"/" * m.V"Stuff")^0 * m.Cc(mm.P""); | ||
195 | Stuff = m.V"GroupedStuff" + any; | ||
196 | GroupedStuff = "(" * (-m.P")" * m.V"Stuff")^0 * ")" | ||
197 | + "{" * (-m.P"}" * m.V"Stuff")^0 * "}"; | ||
198 | SeqLC = m.Lc(m.V"Seq", m.V"SkipToSlash", 5, 6, 7, 8, 9, 10); | ||
194 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul); | 199 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul); |
195 | Prefix = "&" * S * (m.V"Prefix" + throw(5)) / mt.__len | 200 | Prefix = "&" * S * (m.V"Prefix" + throw(5)) / mt.__len |
196 | + "!" * S * (m.V"Prefix" + throw(6)) / mt.__unm | 201 | + "!" * S * (m.V"Prefix" + throw(6)) / mt.__unm |