From 727ee89b490f91a59cd4147c717aa35939940a57 Mon Sep 17 00:00:00 2001 From: Undecidable Robot Date: Sat, 20 Aug 2016 00:50:52 +0800 Subject: Updating re grammar so only one label can be thrown --- relabel.lua | 4 +++- testrelabelparser.lua | 10 ++-------- 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", + String / mm.P + Class + defined - + "%" * expect(m.V"Labels", "ExpNameOrLab") / mm.T + + "%" * expect(m.P"{", "ExpNameOrLab") + * expect(S * m.V"Label", "ExpLab1") + * expect(S * "}", "MisClose7") / mm.T + "{:" * (name * ":" + m.Cc(nil)) * expect(m.V"Exp", "ExpPatt5") * expect(S * ":}", "MisClose2") / 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 ^ ]]) -testerror([[%{ a,,b,,c }]], [[ -L1:C6: expected a label after the comma -%{ a,,b,,c } - ^ -]]) - -- testing ExpNameOrLab testerror([[% s]], [[ @@ -468,9 +462,9 @@ L1:C8: missing closing '>' -- testing MisClose7 testerror([['{' %{ a, b '}']], [[ -L1:C12: missing closing '}' +L1:C9: missing closing '}' '{' %{ a, b '}' - ^ + ^ ]]) -- testing MisClose8 -- cgit v1.2.3-55-g6feb