GreatSyntacticShift: Parser test data fixed

This commit is contained in:
Andrey Breslav
2011-12-21 10:57:09 +02:00
parent 6bad4830c3
commit 91d10790b4
84 changed files with 797 additions and 901 deletions
+4 -4
View File
@@ -24,11 +24,11 @@ class Graph<V, E> {
fun neighbours(v : Vertex<V>) = edges.filter{it.from == v}.map{it.to} // type is IIterable<Vertex<V>>
fun dfs(handler : fun (V) : Unit) {
fun dfs(handler : (V) -> Unit) {
val visited = HashSet<Vertex<V>>()
vertices.foreach{dfs(it, visited, handler)}
fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) {
fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) {
if (!visited.add(current))
return
handler(current)
@@ -36,7 +36,7 @@ class Graph<V, E> {
}
}
public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) {
public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) {
vertices.foreach {
if (!visited.add(it))
continue
@@ -44,7 +44,7 @@ class Graph<V, E> {
while (!pending.isEmpty) {
val current = pending.pop()
handler(current);
neighbours(current).foreach { n =>
neighbours(current).foreach { n ->
if (visited.add(n)) {
pending.push(n)
}