import rebelsky.compiler.misc.CharStream;
import rebelsky.compiler.pascal.PascalTokenizer;

/**
 * A lexical analyzer for the Stupid language.  Since Stupid's tokens differ
 * only from Pascal's in that Read and Write are keywords, we simply
 * extend the Pascal lexeical analyzer to include these two new special
 * values.  (Yes, this assumes a particular implementation for the
 * tokenizer, but that's okay.)
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of November 2002
 */
public class StupidTokenizer
  extends PascalTokenizer
{
  // +--------------+-------------------------------------------------------
  // | Constructors |
  // +--------------+

  /**
   * Build a new tokenizer that uses a particular character stream.
   */
  public StupidTokenizer(CharStream cs) {
    // Set up the PascalTokenizer
    super(cs);
    // Add Stupid's special keywords
    this.addToken("read", StupidTokens.TREAD);
    this.addToken("write", StupidTokens.TWRITE);
  } // StupidTokenizer(CharStream)
  
} // class StupidTokenizer

