import java.io.*; /** * Simple Scanner driver */ public class ScanTest { /** * Test harness for the Scanner class. * @param arg [0] pathname to scan. If not specified, then the program * tries to scan "fm/hello.fm". * @throws IOException thrown if any IO errors occur during processing */ public static void main(String[] arg) throws IOException { Token t; String in = "fm/tA.fm"; if (arg.length > 0) { in = arg[0]; } CompilerIO io = new CompilerIO(in, "txt"); io.setEchoing(true); io.setEchoPrefix("% "); SymbolTable sym = new SymbolTable(1); Scanner scan = new Scanner(io,sym); do { t = scan.nextToken(); io.emit(t.toString()); } while (t.getType() != Token.EOF); io.closeAll(); } }