/* zweic -- a compiler for zwei
*
* Stephane Micheloud & LAMP
*
* $Id$
*/
package zweic;
/**
* A small scanner test class; it reads in a file and prints out
* the sequence of tokens.
*
* usage: scala zweic.ScannerTest <file.zwei>
*/
object ScannerTest {
import java.io.{FileInputStream, IOException};
def main(args: Array[String]): Unit = {
if (args.length != 1) {
Console.println("usage: scala zweic.ScannerTest <file.zwei>");
System.exit(1)
}
try {
val in = new FileInputStream(args(0));
val scanner = new Scanner(in);
while (scanner.token != Tokens.EOF) {
Console.println(scanner.representation);
scanner.nextToken
}
in.close()
}
catch {
case e: IOException => Report.fail(e.getMessage());
}
}
}