progs/scala/re.scala
changeset 49 c616ec6b1e3c
parent 48 652861c9473f
child 62 a6bb0152ccc2
equal deleted inserted replaced
48:652861c9473f 49:c616ec6b1e3c
   259   val end = System.nanoTime()
   259   val end = System.nanoTime()
   260   println((end - start)/1.0e9)
   260   println((end - start)/1.0e9)
   261   result
   261   result
   262 }
   262 }
   263 
   263 
   264 val r = ("a" | "ab") ~ ("bcd" | "c")
   264 val r1 = ("a" | "ab") ~ ("bcd" | "c")
   265 println(lexing(r, "abcd"))
   265 println(lexing(r1, "abcd"))
   266 println(values(r).mkString("\n"))
   266 println(values(r1).mkString("\n"))
   267 println(values(r).map(flatten).mkString("\n"))
   267 println(values(r1).map(flatten).mkString("\n"))
       
   268 
       
   269 val r2 = ("" | "a") ~ ("ab" | "b")
       
   270 println(lexing(r2, "ab"))
       
   271 println(values(r2).mkString("\n"))
       
   272 println(values(r2).toList.map(flatten).mkString("\n"))
       
   273 
       
   274 
   268 
   275 
   269 // Two Simple Tests
   276 // Two Simple Tests
   270 //===================
   277 //===================
   271 println("prog0 test")
   278 println("prog0 test")
   272 
   279