import java.io.FileReader; import java.io.BufferedReader; import rebelsky.compiler.misc.AdvCharStream; import rebelsky.compiler.misc.StandardCharStream; import rebelsky.compiler.lexer.TokenStream; import rebelsky.compiler.lexer.TokenStreamTester; import rebelsky.compiler.pascal.PascalTokenizer; /** * A simple test of the Pascal Tokenizer. Given a file name * specified on the command line, prints out all the tokens * in that file. * * @author Samuel A. Rebelsky * @version 1.0 of October 2002 */ public class TestPT { public static void main(String[] args) throws Exception { String fname; // Determine the file name to use if (args.length == 0) fname = "test1.pas"; else fname = args[0]; // Create the character stream AdvCharStream acs = new AdvCharStream( new StandardCharStream( new BufferedReader( new FileReader(fname)))); // Create the tokenizer TokenStream tokenizer = new PascalTokenizer(acs); // Dump the stream. TokenStreamTester.dump(tokenizer); } // main(String[]) } // class TestPT