-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.h
64 lines (60 loc) · 1.36 KB
/
token.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
CSE 109
Kabir Uttamsingh
kku219
) Program Description: Program #4
*/
#ifndef TOKEN_H
#define TOKEN_H
#include <string>
#include <cstdlib>
using namespace std;
class Token
{
private:
int type;
string lexeme;
int line;
int pos;
public:
int getType();
string getLexeme();
int getLine();
int getPos();
Token();
Token(int type, string lexeme, int line, int pos);
~Token();
//constants
static const int IDENT = 1;
static const int INTLIT = 2;
static const int STRINGLIT = 3;
static const int PLUS = 4;
static const int MINUS = 5;
static const int TIMES = 6;
static const int DIVIDE = 7;
static const int ASSIGN = 8;
static const int EQ = 9;
static const int NE = 10;
static const int LT = 11;
static const int LE = 12;
static const int GT = 13;
static const int GE = 14;
static const int AND = 15;
static const int OR = 16;
static const int LPAREN = 17;
static const int RPAREN = 18;
static const int LBRACE = 19;
static const int RBRACE = 20;
static const int COMMA = 21;
static const int SEMICOLON = 22;
static const int IF = 23;
static const int ELSE = 24;
static const int WHILE = 25;
static const int FUNCTION = 26;
static const int VAR = 27;
static const int PRINTF = 28;
static const int RETURN = 29;
static const int ENDOFFILE = 30;
static const int ERROR = 31;
};
#endif