/* zweic -- a compiler for zwei * * Stephane Micheloud & LAMP * * $Id$ */ package zweic; /** * A small parser test class; it reads in a file and prints out * every/the first syntax error that is found. Programs which * do not yield error messages are supposed to be syntactically * correct. * * usage: scala zweic.ParserTest <file.zwei> */ object ParserTest { import java.io.{FileInputStream, IOException}; def main(args: Array[String]): Unit = { if (args.length == 0) { Console.println("usage: scala zweic.ParserTest <file.zwei>"); System.exit(1) } try { val in = new FileInputStream(args(0)); new Parser(in).parse; in.close(); if (Report.errors > 0) System.err.println(Report.errors + " errors found." ); System.exit(if (Report.errors > 0) 1 else 0); } catch { case e: IOException => Report.fail(e.getMessage()); } } }