author | Christian Urban <urbanc@in.tum.de> |
Sun, 28 Jul 2019 14:24:46 +0100 | |
changeset 624 | 8d0af38389bc |
parent 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] = |
295
19f23c4c2167
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
169
diff
changeset
|
5 |
for ((head, tail) <- parse(ts); |
19f23c4c2167
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
169
diff
changeset
|
6 |
if (tail.isEmpty)) yield head |
66
9215b9fb8852
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
7
diff
changeset
|
7 |
} |
7 | 8 |
|
9 |