changeset 92 | e85600529ca5 |
parent 70 | e6868bd2942b |
91:47f86885d481 | 92:e85600529ca5 |
---|---|
1 abstract class Parser[I, T] { |
|
2 def parse(ts: I): Set[(T, I)] |
|
3 |
|
4 def parse_all(ts: I) : Set[T] = |
|
5 for ((head, tail) <- parse(ts); if (tail.isEmpty)) |
|
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 } |
|
15 |
|
16 |