progs/comb1.scala
changeset 598 278b8b05f286
parent 594 ff496c243d10
child 599 0b512541f7ce
equal deleted inserted replaced
597:9a35b8e67b83 598:278b8b05f286
   140 U.parse_all("1" * 100)
   140 U.parse_all("1" * 100)
   141 U.parse_all("1" * 100 + "0")
   141 U.parse_all("1" * 100 + "0")
   142 
   142 
   143 lazy val UCount : Parser[String, Int] =
   143 lazy val UCount : Parser[String, Int] =
   144   ("1" ~ UCount) ==> { case (x, y) => y + 1 } | 
   144   ("1" ~ UCount) ==> { case (x, y) => y + 1 } | 
   145   "" ==> { (x) => 0 }
   145   "" ==> { x => 0 }
   146 
   146 
   147 UCount.parse("11111")
   147 UCount.parse("11111")
   148 UCount.parse_all("11111")
   148 UCount.parse_all("11111")
   149 
   149 
   150 
   150