diff options
Diffstat (limited to 'testlabel.lua')
-rw-r--r-- | testlabel.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/testlabel.lua b/testlabel.lua index d4cc815..1962fbf 100644 --- a/testlabel.lua +++ b/testlabel.lua | |||
@@ -101,6 +101,15 @@ assert(p:match("aa") == nil) | |||
101 | p = (m.P"a" + m.T(0))^0 | 101 | p = (m.P"a" + m.T(0))^0 |
102 | assert(p:match("aa") == 3) | 102 | assert(p:match("aa") == 3) |
103 | 103 | ||
104 | -- Bug reported by Matthew Allen | ||
105 | -- some optmizations performed by LPeg should not be | ||
106 | -- applied in case of labeled choices | ||
107 | p = m.Lc(m.P"A", m.P(true), 1) + m.P("B") | ||
108 | assert(p:match("B") == 2) | ||
109 | |||
110 | p = m.Lc(m.P"A", m.P(false), 1) + m.P("B") | ||
111 | assert(p:match("B") == 2) | ||
112 | |||
104 | 113 | ||
105 | --[[ | 114 | --[[ |
106 | S -> A /{1} 'a' | 115 | S -> A /{1} 'a' |