1 import M3._ |
1 import M3._ |
2 |
2 |
3 assert(der('a', ZERO | ONE) == (ZERO | ZERO)) |
3 assert(der('a', ZERO | ONE) == ALT(ZERO, ZERO)) |
4 assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALT((ONE | ZERO) ~ CHAR('a'), ONE)) |
4 assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALTs(List(SEQ(ALT(ONE, ZERO), CHAR('a')), SEQs(List(ONE))))) |
5 assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')) |
5 assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')) |
6 assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))) |
6 assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))) |
7 assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))) |
7 assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))) |
8 |
8 |
9 |
9 |
12 assert(der('b', r0_urban) == (ZERO ~ "b") ~ "c") |
12 assert(der('b', r0_urban) == (ZERO ~ "b") ~ "c") |
13 assert(der('c', r0_urban) == (ZERO ~ "b") ~ "c") |
13 assert(der('c', r0_urban) == (ZERO ~ "b") ~ "c") |
14 |
14 |
15 val r1_urban = (ONE ~ "b") ~ "c" |
15 val r1_urban = (ONE ~ "b") ~ "c" |
16 |
16 |
17 assert(der('a', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c") |
17 assert(der('a', r1_urban) == ((ZERO ~ "b") | SEQs(List(ZERO))) ~ "c") |
18 assert(der('b', r1_urban) == ((ZERO ~ "b") | ONE) ~ "c") |
18 assert(der('b', r1_urban) == ((ZERO ~ "b") | SEQs(List(ONE))) ~ "c") |
19 assert(der('c', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c") |
19 assert(der('c', r1_urban) == ((ZERO ~ "b") | SEQs(List(ZERO))) ~ "c") |
20 |
20 |
21 val r2_urban = ((ZERO ~ "b") | ONE) ~ "c" |
21 val r2_urban = ((ZERO ~ "b") | ONE) ~ "c" |
22 |
22 |
23 assert(der('a', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO)) |
23 assert(der('a', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ZERO)))) |
24 assert(der('b', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO)) |
24 assert(der('b', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ZERO)))) |
25 assert(der('c', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ONE)) |
25 assert(der('c', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ONE)))) |
|
26 |