Lexer.h 516 B

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