-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToken.java
More file actions
117 lines (109 loc) · 2.05 KB
/
Token.java
File metadata and controls
117 lines (109 loc) · 2.05 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import java.awt.*;
public class Token {
public static final int IDENT=0,NUMBER=1,EOF=-1;
/**
* EQ : ==
*/
public static final int EQ=2;
/**
* ASSIGN : =
*/
public static final int ASSIGN=3;
/**
* SEMICOLON : ;
*/
public static final int SEMICOLON=4;
/**
* LPAR : (
*/
public static final int LPAR=5;
/**
* RPAR : )
*/
public static final int RPAR=6;
/**
* LBRACE : {
*/
public static final int LBRACE=7;
/**
* RBRACE : }
*/
public static final int RBRACE=8;
/**
* ADD : +
*/
public static final int ADD=9;
/**
* SUB : -
*/
public static final int SUB=10;
/**
* MULT : *
*/
public static final int MULT=11;
/**
* DIV : /
*/
public static final int DIV=12;
/**
* S : <
*/
public static final int S=13;
/**
* L : >
*/
public static final int L=14;
/**
* MOD : %
*/
public static final int MOD=15;
/**
* COMMA : ,
*/
public static final int COMMA=16;
/**
* NOT : !
*/
public static final int NOT=17;
/**
* OR : ||
*/
public static final int OR=18;
/**
* AND : &&
*/
public static final int AND=19;
/**
* NEQ : !=
*/
public static final int NEQ=20;
/**
* SE : <=
*/
public static final int SE=21;
/**
* LE : >=
*/
public static final int LE=22;
/**
* LBRACKET : [
*/
public static final int LBRACKET = 23;
/**
* RBRACKET : ]
*/
public static final int RBRACKET = 24;
public static final int IF=50,ELSE=51,WHILE=52,BREAK=53,CONTINUE=54,RETURN=55,INT=56,MAIN=57,CONST=58,VOID = 59;
public int type;
public String content;
public Token(){
}
public Token(int type) {
this.type = type;
this.content = "";
}
public Token(int type, String content) {
this.type = type;
this.content = content;
}
}