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;

/**
 * A simple test of the Stupid 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 December 2002
 */
public class TestST
{
  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 StupidTokenizer(acs);

    // Dump the stream.
    TokenStreamTester.dump(tokenizer);
  } // main(String[])
} // class TestPT

