/*  This  Tokens - by inheritance from Adts.

    To use this  must include  Token  in your #include clause, e.g.,

        #include Crt, Tokens;

    Author: Larry Morell

    Revision history

    Date       Modification
    2/17/93    Original version
    2/26/93    Added XUnitSym"s to the Token Typees
    4/2/99     Converted to C++
*/
#include <stdio.h>
#include "CharSets.h"
#define Text FILE *

const int doTest = false;

   enum TokenType {
      assignSym,
      assignUnitSym,
      beginSym,
      colonSym,
      constSym,
      doSym,
      doneSym,
      eofSym, 
      errorSym,
      fiSym,
      ifSym,
      ifthenSym,
      ifUnitSym,
      initSym,
      gotoSym,
      gotoUnitSym,
      labelUnitSym,
      lStmtUnitSym,
      minusSym,
      periodSym,
      plusSym,
      programUnitSym,
      stmtListUnitSym,
      stmtUnitSym,
      thenSym,
      varSym,
      whileSym
      };

class TokenDesc 
{ public:
    TokenType type;
    char val[40];
};

class Token {
  public:
    Token(TokenType C);               // initialize token to ("",C) 
    Token(TokenType C, char* s);      // initialize token to (s,C) 
    Token();
    ~Token();                         // destroy a Token
    void init(TokenType C, char *s);  // initialize token to (s,C) 
    void init(TokenType C);           // initialize tokenn to ("",C)
    void Token::copy(Token &A);
    void Token::initcopy(Token &A);
    void done();                      // destroy a Token
    virtual void write(Text F);       // write token to file F
    virtual void get();
    virtual int size(); 
    virtual int equal(Token &A); 
    TokenType type();
    char *val();
  private:
    virtual void getBuf(CharSet t);   // get an internal
    TokenDesc * P;
};

void getChar();
void setTokenSource(char * Filename);
TokenType succ(TokenType s);
char * tokenTypeStr(TokenType C);

extern  char    ch;  /* The global character */
extern  Token   t ;  /* The global token */



