progs/comb2.scala
changeset 683 c6c79d21f8a8
parent 673 715b46eee102
child 684 1ee523c4f098
--- a/progs/comb2.scala	Wed Nov 06 21:52:42 2019 +0000
+++ b/progs/comb2.scala	Wed Nov 06 23:17:05 2019 +0000
@@ -14,7 +14,7 @@
   def parse(ts: I): Set[(T, I)]
 
   def parse_all(ts: I) : Set[T] =
-    for ((head, tail) <- parse(ts); if (tail.isEmpty)) yield head
+    for ((head, tail) <- parse(ts); if tail.isEmpty) yield head
 }
 
 class SeqParser[I : IsSeq, T, S](p: => Parser[I, T], q: => Parser[I, S]) extends Parser[I, ~[T, S]] {
@@ -123,7 +123,7 @@
    ("(" ~ BExp ~ ")" ~ "||" ~ BExp) ==> { case x ~ y ~ z ~ u ~ v => Or(y, v): BExp } ||
    ("true" ==> (_ => True: BExp )) || 
    ("false" ==> (_ => False: BExp )) ||
-   ("(" ~ BExp ~ ")") ==> { case x ~ y ~ z => y}
+   ("(" ~ BExp ~ ")") ==> { case _ ~ x ~ _ => x }
 
 // statement / statements
 lazy val Stmt: Parser[String, Stmt] =