diff options
| author | Undecidable Robot <undecidabot@gmail.com> | 2016-05-16 19:53:22 +0800 |
|---|---|---|
| committer | Undecidable Robot <undecidabot@gmail.com> | 2016-05-16 19:53:53 +0800 |
| commit | 025e0c375de5fca0b220d66d3e1f59837a020137 (patch) | |
| tree | 03b5a32c569f23e0a442b06a7ea28fcd5f370cb7 | |
| parent | f3dcbf4b2ea2848a5fc0748141e53da984863e05 (diff) | |
| download | lpeglabel-025e0c375de5fca0b220d66d3e1f59837a020137.tar.gz lpeglabel-025e0c375de5fca0b220d66d3e1f59837a020137.tar.bz2 lpeglabel-025e0c375de5fca0b220d66d3e1f59837a020137.zip | |
Unifying ordered choice and labeled choice
| -rw-r--r-- | relabel.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/relabel.lua b/relabel.lua index f6bf080..ed3a6ed 100644 --- a/relabel.lua +++ b/relabel.lua | |||
| @@ -186,11 +186,10 @@ local function labchoice (...) | |||
| 186 | return p | 186 | return p |
| 187 | end | 187 | end |
| 188 | 188 | ||
| 189 | |||
| 190 | local exp = m.P{ "Exp", | 189 | local exp = m.P{ "Exp", |
| 191 | Exp = S * ( m.V"Grammar" | 190 | Exp = S * ( m.V"Grammar" |
| 192 | + (m.V"Seq") * ("/" * m.V"Labels" * S * (m.V"Seq" + throw(3)))^1 / labchoice | 191 | + (m.V"Seq" * ("/" * (m.V"Labels" + m.Cc({0})) * S |
| 193 | + m.Cf(m.V"Seq" * ("/" * S * m.Lc(m.V"Seq" + throw(4), (-m.P"/" * any)^0, 4, 5, 6, 7, 8, 9, 10))^0, mt.__add) ); | 192 | * m.Lc(m.V"Seq" + throw(4), (-m.P"/" * any)^0, 4, 5, 6, 7, 8, 9, 10))^0) / labchoice ); |
| 194 | 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))); |
| 195 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul); | 194 | Seq = m.Cf(m.Cc(m.P"") * m.V"Prefix"^1 , mt.__mul); |
| 196 | Prefix = "&" * S * (m.V"Prefix" + throw(5)) / mt.__len | 195 | Prefix = "&" * S * (m.V"Prefix" + throw(5)) / mt.__len |
