main_testing3/re_test2.scala
changeset 475 59e005dcf163
parent 433 6af86ba1208f
equal deleted inserted replaced
474:b528d1d3d3c3 475:59e005dcf163
     1 import M3._
       
     2 
     1 
     3 assert(der('a', ZERO | ONE) == ALT(ZERO, ZERO))
     2 def urbanmain() = {
     4 assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALTs(List(SEQ(ALT(ONE, ZERO), CHAR('a')), SEQs(List(ONE)))))
     3   import M3._
     5 assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a'))
     4 
     6 assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a'))))
     5   assert(der('a', ZERO | ONE) == ALT(ZERO, ZERO))
     7 assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a'))))
     6   assert(der('a', (CHAR('a') | ONE) ~ CHAR('a')) == ALTs(List(SEQ(ALT(ONE, ZERO), CHAR('a')), SEQs(List(ONE)))))
       
     7   assert(der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a'))
       
     8   assert(der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a'))))
       
     9   assert(der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a'))))
       
    10 }
       
    11 
     8 
    12 
     9 /*
    13 /*
    10 val r0_urban = "a" ~ "b" ~ "c"
    14 val r0_urban = "a" ~ "b" ~ "c"
    11 assert(der('a', r0_urban) == (ONE ~ "b") ~ "c")
    15 assert(der('a', r0_urban) == (ONE ~ "b") ~ "c")
    12 assert(der('b', r0_urban) == (ZERO ~ "b") ~ "c")
    16 assert(der('b', r0_urban) == (ZERO ~ "b") ~ "c")