aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUndecidable Robot <undecidabot@gmail.com>2016-08-20 00:50:52 +0800
committerUndecidable Robot <undecidabot@gmail.com>2016-08-20 00:50:52 +0800
commit727ee89b490f91a59cd4147c717aa35939940a57 (patch)
tree14dfd4781579ab2735756739a90361cca3b04985
parentfcb4f1bf2172186cef1fa3fb57be5cd03aaba713 (diff)
downloadlpeglabel-727ee89b490f91a59cd4147c717aa35939940a57.tar.gz
lpeglabel-727ee89b490f91a59cd4147c717aa35939940a57.tar.bz2
lpeglabel-727ee89b490f91a59cd4147c717aa35939940a57.zip
Updating re grammar so only one label can be thrown
-rw-r--r--relabel.lua4
-rw-r--r--testrelabelparser.lua10
2 files changed, 5 insertions, 9 deletions
diff --git a/relabel.lua b/relabel.lua
index 7fe8645..b541dec 100644
--- a/relabel.lua
+++ b/relabel.lua
@@ -264,7 +264,9 @@ local exp = m.P{ "Exp",
264 + String / mm.P 264 + String / mm.P
265 + Class 265 + Class
266 + defined 266 + defined
267 + "%" * expect(m.V"Labels", "ExpNameOrLab") / mm.T 267 + "%" * expect(m.P"{", "ExpNameOrLab")
268 * expect(S * m.V"Label", "ExpLab1")
269 * expect(S * "}", "MisClose7") / mm.T
268 + "{:" * (name * ":" + m.Cc(nil)) * expect(m.V"Exp", "ExpPatt5") 270 + "{:" * (name * ":" + m.Cc(nil)) * expect(m.V"Exp", "ExpPatt5")
269 * expect(S * ":}", "MisClose2") 271 * expect(S * ":}", "MisClose2")
270 / function (n, p) return mm.Cg(p, n) end 272 / function (n, p) return mm.Cg(p, n) end
diff --git a/testrelabelparser.lua b/testrelabelparser.lua
index 46e01ee..1f1a8cf 100644
--- a/testrelabelparser.lua
+++ b/testrelabelparser.lua
@@ -371,12 +371,6 @@ L1:C13: expected a label after the comma
371 ^ 371 ^
372]]) 372]])
373 373
374testerror([[%{ a,,b,,c }]], [[
375L1:C6: expected a label after the comma
376%{ a,,b,,c }
377 ^
378]])
379
380-- testing ExpNameOrLab 374-- testing ExpNameOrLab
381 375
382testerror([[% s]], [[ 376testerror([[% s]], [[
@@ -468,9 +462,9 @@ L1:C8: missing closing '>'
468-- testing MisClose7 462-- testing MisClose7
469 463
470testerror([['{' %{ a, b '}']], [[ 464testerror([['{' %{ a, b '}']], [[
471L1:C12: missing closing '}' 465L1:C9: missing closing '}'
472'{' %{ a, b '}' 466'{' %{ a, b '}'
473 ^ 467 ^
474]]) 468]])
475 469
476-- testing MisClose8 470-- testing MisClose8