cppToken.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Filename: cppToken.h
  2. // Created by: drose (22Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef CPPTOKEN_H
  15. #define CPPTOKEN_H
  16. #include "dtoolbase.h"
  17. #include "cppBisonDefs.h"
  18. ///////////////////////////////////////////////////////////////////
  19. // Class : CPPToken
  20. // Description :
  21. ////////////////////////////////////////////////////////////////////
  22. class CPPToken {
  23. public:
  24. CPPToken(int token, int line_number = 0, int col_number = 0,
  25. const CPPFile &file = CPPFile(""),
  26. const string &str = string(),
  27. const YYSTYPE &lval = YYSTYPE());
  28. CPPToken(int token, const YYLTYPE &loc,
  29. const string &str = string(),
  30. const YYSTYPE &lval = YYSTYPE());
  31. CPPToken(const CPPToken &copy);
  32. void operator = (const CPPToken &copy);
  33. static CPPToken eof();
  34. bool is_eof() const;
  35. void output(ostream &out) const;
  36. int _token;
  37. YYSTYPE _lval;
  38. YYLTYPE _lloc;
  39. };
  40. inline ostream &operator << (ostream &out, const CPPToken &token) {
  41. token.output(out);
  42. return out;
  43. }
  44. #endif