progs/comb1.scala
changeset 598 e3ad67cd5123
parent 594 d40d7d7b85bc
child 599 33c4b580092b
equal deleted inserted replaced
597:ce8419e3915c 598:e3ad67cd5123
   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