*** empty log message ***
1 parent aaf8012 commit 13187a06147dd72c835a2783f1481f254baf42b6
@glproj03 glproj03 authored on 20 Nov 2005
Showing 1 changed file
View
41
sources/zweic/ParserTest.scala 0 → 100755
/* 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());
}
}
 
}