201 } |
201 } |
202 |
202 |
203 println(Parser("a|(bc)*").Regex()) |
203 println(Parser("a|(bc)*").Regex()) |
204 |
204 |
205 |
205 |
206 def process(line: String) : String = { |
206 def process_line(line: String) : String = { |
207 if (line.head == '#') "#" else |
207 if (line.head == '#') "#" else |
208 { |
208 { |
209 val line_split = line.split("\\t+") |
209 val line_split = line.split("\\t+") |
210 val reg_str = line_split(1) |
210 val reg_str = line_split(1) |
211 val reg = RECD("", Parser(reg_str).Regex()) |
211 val reg = RECD("", Parser(reg_str).Regex()) |
224 } |
224 } |
225 else "*" |
225 else "*" |
226 } |
226 } |
227 } |
227 } |
228 |
228 |
229 |
229 def process_file(name : String) : Unit = { |
230 //val filename = "../tests/forced-assoc.txt" |
230 println("\nProcessing " + name) |
231 //val filename = "../tests/left-assoc.txt" |
231 val filelines : List[String] = Source.fromFile(name).getLines.toList |
232 //val filename = "../tests/right-assoc.txt" |
232 filelines.foreach((s: String) => print(process_line(s))) |
233 //val filename = "../tests/class.txt" |
233 } |
234 //val filename = "../tests/basic3.txt" |
234 |
235 //val filename = "../tests/totest.txt" |
235 |
236 //val filename = "../tests/repetition2.txt" |
236 val files = List("../tests/forced-assoc.txt", |
237 //val filename = "../tests/osx-bsd-critical.txt" |
237 "../tests/left-assoc.txt", |
238 val filename = "../tests/nullsub3.txt" |
238 //"../tests/right-assoc.txt", |
239 val filelines : List[String] = Source.fromFile(filename).getLines.toList |
239 "../tests/class.txt", |
240 |
240 "../tests/basic3.txt", |
241 |
241 "../tests/totest.txt", |
242 filelines.foreach((s: String) => print(process(s))) |
242 "../tests/repetition2.txt", |
243 |
243 "../tests/osx-bsd-critical.txt") |
|
244 |
|
245 files.foreach(process_file(_)) |
|
246 |