Lexer.h 490 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef _LEXER_H
  2. #define _LEXER_H
  3. // Standard includes
  4. #include <string>
  5. namespace lexer{
  6. // The lexer returns tokens [0-255] if it is an unknown character, otherwise one
  7. // of these for known things.
  8. enum Token {
  9. tok_eof = -1,
  10. // commands
  11. tok_def = -2,
  12. tok_extern = -3,
  13. // primary
  14. tok_identifier = -4,
  15. tok_number = -5
  16. };
  17. struct LexerObjects {
  18. public:
  19. static std::string IdentifierStr; // Filled in if tok_identifier
  20. static double NumVal;
  21. };
  22. int gettok();
  23. }
  24. #endif