main_marking3/re_test2.scala
changeset 463 0315d9983cd0
parent 424 daf561a83ba6
--- a/main_marking3/re_test2.scala	Sun Jan 15 10:58:13 2023 +0000
+++ b/main_marking3/re_test2.scala	Sat Mar 11 22:01:53 2023 +0000
@@ -1,7 +1,7 @@
 import M3._
 
-assert(der('a', ZERO | ONE) == (ZERO | ZERO))
-assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALT((ONE | ZERO) ~ CHAR('a'), ONE))
+assert(der('a', ZERO | ONE) == ALT(ZERO, ZERO))
+assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALTs(List(SEQ(ALT(ONE, ZERO), CHAR('a')), SEQs(List(ONE)))))
 assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a'))
 assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a'))))
 assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a'))))
@@ -14,12 +14,13 @@
 
 val r1_urban = (ONE ~ "b") ~ "c"
 
-assert(der('a', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c")
-assert(der('b', r1_urban) == ((ZERO ~ "b") | ONE) ~ "c")
-assert(der('c', r1_urban) == ((ZERO ~ "b") | ZERO) ~ "c")
+assert(der('a', r1_urban) == ((ZERO ~ "b") | SEQs(List(ZERO))) ~ "c")
+assert(der('b', r1_urban) == ((ZERO ~ "b") | SEQs(List(ONE))) ~ "c")
+assert(der('c', r1_urban) == ((ZERO ~ "b") | SEQs(List(ZERO))) ~ "c")
 
 val r2_urban = ((ZERO ~ "b") | ONE) ~ "c"
 
-assert(der('a', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
-assert(der('b', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ZERO))
-assert(der('c', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | ONE))
+assert(der('a', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ZERO))))
+assert(der('b', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ZERO))))
+assert(der('c', r2_urban) == ((((ZERO ~ "b") | ZERO) ~ "c") | SEQs(List(ONE))))
+