aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUndecidable Robot <undecidabot@gmail.com>2016-05-24 12:34:08 +0800
committerUndecidable Robot <undecidabot@gmail.com>2016-05-24 12:34:08 +0800
commit389609e4299c0ca2295d55ac1c8622d14d31935c (patch)
treeb81bbd89af25999847cd1c182503cda5d2d40fe6
parentd891c969fca34d1b5ea3a41835d73ec7d067d6eb (diff)
downloadlpeglabel-389609e4299c0ca2295d55ac1c8622d14d31935c.tar.gz
lpeglabel-389609e4299c0ca2295d55ac1c8622d14d31935c.tar.bz2
lpeglabel-389609e4299c0ca2295d55ac1c8622d14d31935c.zip
Enabling the recovery from all labels
-rw-r--r--relabel.lua20
-rw-r--r--testerrors.lua6
2 files changed, 20 insertions, 6 deletions
diff --git a/relabel.lua b/relabel.lua
index 170cb66..b0a6efc 100644
--- a/relabel.lua
+++ b/relabel.lua
@@ -260,18 +260,28 @@ end
260 260
261local labelset1 = labify { 261local labelset1 = labify {
262 "ExpPatt2", "ExpPatt3", 262 "ExpPatt2", "ExpPatt3",
263 "ExpNum", "ExpCap", "ExpName1", 263 "ExpPatt4", "ExpPatt5", "ExpPatt6", "ExpPatt7",
264 "ExpPatt8", "ExpPattOrClose",
265 "ExpNum", "ExpCap",
266 "ExpName1", "ExpName2", "ExpName3",
267 "ExpNameOrLab", "ExpItem",
268 "MisClose6"
264} 269}
265 270
266local labelset2 = labify { 271local labelset2 = labify {
267 "MisClose1", "MisClose2", "MisClose3", "MisClose4", "MisClose5", "MisClose7" 272 "MisClose1", "MisClose2", "MisClose3", "MisClose4", "MisClose5"
273}
274
275local labelset3 = labify {
276 "ExpPatt1", "ExpLab1", "ExpLab2", "MisClose7"
268} 277}
269 278
270local exp = m.P{ "Exp", 279local exp = m.P{ "Exp",
271 Exp = S * ( m.V"Grammar" 280 Exp = S * ( m.V"Grammar"
272 + (m.V"SeqLC" * (S * "/" * (m.Ct(m.V"Labels") + m.Cc(nil)) 281 + (m.V"SeqLC" * (S * "/" * m.Lc((m.Ct(m.V"Labels") + m.Cc(nil))
273 * m.Lc(expect(S * m.V"SeqLC", "ExpPatt1"), 282 * expect(S * m.V"SeqLC", "ExpPatt1"),
274 m.V"SkipToSlash", labels["ExpPatt1"]) 283 m.Cc(nil) * m.V"SkipToSlash",
284 unpack(labelset3))
275 )^0 285 )^0
276 ) / labchoice); 286 ) / labchoice);
277 Labels = m.P"{" * expect(S * m.V"Label", "ExpLab1") 287 Labels = m.P"{" * expect(S * m.V"Label", "ExpLab1")
diff --git a/testerrors.lua b/testerrors.lua
index c118e00..fbf5cc9 100644
--- a/testerrors.lua
+++ b/testerrors.lua
@@ -135,7 +135,7 @@ local patterns = {
135 S <- [a-z / T 135 S <- [a-z / T
136 T <- 'x' / & / 'y' 136 T <- 'x' / & / 'y'
137 ]], 137 ]],
138 -- 86 - 87 138 -- 86 - 88
139 [[ 139 [[
140 S <- ('p' -- comment 140 S <- ('p' -- comment
141 ]], 141 ]],
@@ -145,6 +145,10 @@ local patterns = {
145 Q <- 'q' 145 Q <- 'q'
146 R <- 'r' 146 R <- 'r'
147 S <- 's' 147 S <- 's'
148 ]],
149 [[
150 A <- 'A' /{'lab'} B / !
151 B <- %{1, 2 3} 'b' / '6' & / 'B'
148 ]] 152 ]]
149} 153}
150 154