# HG changeset patch # User Christian Urban # Date 1465648125 -3600 # Node ID 5fa8344a51762ee2b4d3cff0c81b3d837e1e871e # Parent c2d36c3cf8ad2f8374aff3c6071615d4dfe24467 added test processing diff -r c2d36c3cf8ad -r 5fa8344a5176 progs/scala/tests.scala --- a/progs/scala/tests.scala Fri Jun 10 23:53:46 2016 +0100 +++ b/progs/scala/tests.scala Sat Jun 11 13:28:45 2016 +0100 @@ -203,7 +203,7 @@ println(Parser("a|(bc)*").Regex()) -def process(line: String) : String = { +def process_line(line: String) : String = { if (line.head == '#') "#" else { val line_split = line.split("\\t+") @@ -226,18 +226,21 @@ } } - -//val filename = "../tests/forced-assoc.txt" -//val filename = "../tests/left-assoc.txt" -//val filename = "../tests/right-assoc.txt" -//val filename = "../tests/class.txt" -//val filename = "../tests/basic3.txt" -//val filename = "../tests/totest.txt" -//val filename = "../tests/repetition2.txt" -//val filename = "../tests/osx-bsd-critical.txt" -val filename = "../tests/nullsub3.txt" -val filelines : List[String] = Source.fromFile(filename).getLines.toList +def process_file(name : String) : Unit = { + println("\nProcessing " + name) + val filelines : List[String] = Source.fromFile(name).getLines.toList + filelines.foreach((s: String) => print(process_line(s))) +} -filelines.foreach((s: String) => print(process(s))) +val files = List("../tests/forced-assoc.txt", + "../tests/left-assoc.txt", + //"../tests/right-assoc.txt", + "../tests/class.txt", + "../tests/basic3.txt", + "../tests/totest.txt", + "../tests/repetition2.txt", + "../tests/osx-bsd-critical.txt") +files.foreach(process_file(_)) +