progs/app7.scala
changeset 169 57df3d7b4a25
parent 93 4794759139ea
child 295 19f23c4c2167
equal deleted inserted replaced
168:e60c4a9ba340 169:57df3d7b4a25
     2   def parse(ts: I): Set[(T, I)]
     2   def parse(ts: I): Set[(T, I)]
     3 
     3 
     4   def parse_all(ts: I) : Set[T] =
     4   def parse_all(ts: I) : Set[T] =
     5     for ((head, tail) <- parse(ts); if (tail.isEmpty)) 
     5     for ((head, tail) <- parse(ts); if (tail.isEmpty)) 
     6       yield head
     6       yield head
     7 
       
     8   def || (right : => Parser[I, T]) : Parser[I, T] = 
       
     9       new AltParser(this, right)
       
    10   def ==>[S] (f: => T => S) : Parser [I, S] = 
       
    11       new FunParser(this, f)
       
    12    def ~[S] (right : => Parser[I, S]) : Parser[I, (T, S)] = 
       
    13       new SeqParser(this, right)
       
    14 }
     7 }
    15 
     8 
    16 
     9