author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Sun, 12 Oct 2014 19:39:55 +0100 | |
changeset 272 | 1446bc47a294 |
parent 169 | 57df3d7b4a25 |
child 295 | 19f23c4c2167 |
permissions | -rw-r--r-- |
66
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
1 |
abstract class Parser[I, T] { |
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
2 |
def parse(ts: I): Set[(T, I)] |
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
3 |
|
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
4 |
def parse_all(ts: I) : Set[T] = |
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
5 |
for ((head, tail) <- parse(ts); if (tail.isEmpty)) |
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
6 |
yield head |
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
7 |
} |
7 | 8 |
|
9 |