/******************************************************************
 * File: ps20_token.hpp
 *
 * This file was automatically generated by CppCC Version 0.0.5
 * DO NOT EDIT MANUALLY
 ******************************************************************/


#ifndef __PS20_TOKEN_HH__
#define __PS20_TOKEN_HH__

#include <string>
#include <sstream>
using namespace std;
 
#pragma warning(disable : 4290)
#pragma warning(disable : 4786)


namespace ps20
{

class Position
{
  public:
    Position () : ln(0) {}
    Position (int ln_, int col_) : ln(ln_) {}
    Position (const Position &o) : ln(o.ln) {}
    
    operator string () const
    {
      ostringstream oss;
      oss << ln << ":";
      return oss.str();
    }
    
    int ln;
};

class ps20_token
{
  friend class ps20_scanner;
  public:
    
    ps20_token () : _img_valid(true) {}
    ps20_token (int id_, const std::string &_str_img_, 
              const Position &bPos_, const Position &ePos_) :
      _str_img(_str_img_), _img_valid(true), id(id_), bPos(bPos_), ePos(ePos_)
    {}
    ps20_token (int id_, const Position &bPos_, const Position &ePos_) :
      _img_valid(true), id(id_), bPos(bPos_), ePos(ePos_)
    {}
    ps20_token (int id_) : 
      _img_valid(true), id(id_)
    {}
    ps20_token (const std::string &_str_img_) : 
      _str_img(_str_img_), _img_valid(true)
    { length = _str_img.length(); }
    ps20_token (int id_, const Position &bPos_) :
      _img_valid(true), id(id_), bPos(bPos_), ePos(bPos_)
    {}
  
  public:
    Position bPos, ePos;
    int id;
    int length;
    std::string& image()
    {
      _cacheImg();
      return _str_img;
    }
  
  private:
    const char *_img_start; //points into the scanner's buffer
    bool _img_valid; //true if the string image is in sync with the buffer
    std::string _str_img; //caches the image as a string
    
    void _set (int id_, const Position &bPos_, const Position &ePos_,
               const char *_img_start_, int length_)
    {
      id = id_; bPos = bPos_; ePos = ePos_;
      _img_start = _img_start_; length = length_;
      _img_valid = false;
    }
    
    void _set (const char *_img_start_, int length_)
    {
      _img_start = _img_start_; length = length_;
      _img_valid = false;
    }
    void _cacheImg()
    {
      if (!_img_valid) {
        _str_img.assign(_img_start, length);
        _img_valid = true;
      }
    }
    
  private: // user code
  
public:
	int integer;
	double real;


  
   /* Token id constants: */
  public:
  
    static const int eof;
    static const int BLANK;
    static const int COMMENT1;
    static const int COMMENT2;
    static const int LONG_COMMENT1;
    static const int LONG_COMMENT2;
    static const int LONG_COMMENT3;
    static const int LONG_COMMENT4;
    static const int LONG_COMMENT5;
    static const int LONG_COMMENT;
    static const int EOL;
    static const int PS_2_0;
    static const int DCL;
    static const int DCL_2D;
    static const int DCL_CUBE;
    static const int DCL_VOLUME;
    static const int DEF;
    static const int ABS;
    static const int ADD;
    static const int CMP;
    static const int CRS;
    static const int DP2ADD;
    static const int DP3;
    static const int DP4;
    static const int EXP;
    static const int FRC;
    static const int LOG;
    static const int LRP;
    static const int M3X2;
    static const int M3X3;
    static const int M3X4;
    static const int M4X3;
    static const int M4X4;
    static const int MAD;
    static const int MAX;
    static const int MIN;
    static const int MOV;
    static const int MUL;
    static const int NOP;
    static const int NRM;
    static const int POW;
    static const int RCP;
    static const int RSQ;
    static const int SINCOS;
    static const int SUB;
    static const int TEXKILL;
    static const int TEXLD;
    static const int TEXLDB;
    static const int TEXLDP;
    static const int _SAT;
    static const int _PP;
    static const int INTEGER;
    static const int REAL;
    static const int V;
    static const int C;
    static const int T;
    static const int S;
    static const int R;
    static const int O_C;
    static const int O_DEPTH;
    static const int X;
    static const int Y;
    static const int Z;
    static const int W;
    static const int COMMA;
    static const int DOT;
    static const int MINUS;
    
}; // end of ps20_token class


} // end namespace ps20
#endif // ifndef __PS20_TOKEN_HH__


/* End of file. */
