Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. enum class LexemType {
  6. num, chr, str, id, lpar, rpar, lbrace, rbrace, lbracket, rbracket,
  7. semicolon, comma, colon, opassign, opplus, opminus, opmult, opinc, opeq, opne, oplt,
  8. opgt, ople, opnot, opor, opand, kwint, kwchar, kwif, kwelse, kwswitch, kwcase, kwwhile,
  9. kwfor, kwreturn, kwin, kwout, eof, error
  10. };
  11.  
  12.  
  13. class Token {
  14. private:
  15.  
  16. LexemType _type;
  17. int _value;
  18. string _str;
  19.  
  20. public:
  21.  
  22. // Setters
  23. Token(LexemType type) : _type(type) {};
  24.  
  25. Token(int value) : _value(value) {};
  26.  
  27. Token(LexemType type, const string &str) : _type(type), _str(str) {};
  28.  
  29. Token(char c) : _value(c) {};
  30.  
  31. // Getters
  32. int value() { return _value; };
  33.  
  34. string str() { return _str; };
  35.  
  36. LexemType type() {};
  37.  
  38. // Other
  39.  
  40. void print(ostream &stream) {};
  41.  
  42. string LexemTypeToStr(LexemType type) {
  43. switch (type) {
  44. case LexemType::num:
  45. return "num";
  46. }
  47. case
  48. };
  49. };
  50.  
  51.  
  52.  
  53. int main() {
  54. return 0;
  55. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement