/**
 * This class represents the most basic possible form of token, supporting
 * only the raw token string and a token type field (integer).  More
 * sophisticated token types can be realized by extending it.
 *
 * @author Terran Lane
 * @version 1.0
 */
public class BaseToken extends AbstractToken {

  public BaseToken(String tstr, int ttype) {
    if (tstr==null) {
      throw new NullPointerException("String arg to BaseToken constructor" +
				     "must be non-null");
    }
    if (ttype<0) {
      throw new IllegalArgumentException("Token type arg to BaseToken " +
					 "constructor must be >=0, not " +
					 "ttype=" + ttype);
    }
    _s=tstr;
    _t=ttype;
  }

  public String getTokStr() { return _s; }
  public int getTokType() { return _t; }

  public static final int T_INT=1;
  public static final int T_WORD=2;
  public static final int T_UNKN=0;

  /* ******************** end of public interface ******************** */

  private final String _s;
  private final int _t;

  // Prevent instantiation of this class via a default constructor.  Note,
  // this trick also prevents sub-classes from having no-arg constructors
  // that implicitly rely on this one.
  private BaseToken() {
    // if we get here, something is very seriously wrong...
    assert false;
    // these exist only to satisfy the Java compiler
    _s=null;
    _t=-1;
  }
}
