-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToken.java
More file actions
34 lines (30 loc) · 972 Bytes
/
Token.java
File metadata and controls
34 lines (30 loc) · 972 Bytes
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
public class Token{
public int kind;
public Token(String spelling){
kind = -1;
for(int k = ATTRIB; k <= CONSUMER; k++)
if(spelling.equals(spellings[k])){
this.kind = (byte)k;
break;
}
}
public final static byte
ATTRIB = 0, //attrib
COPY = 1, //copy
DATE = 2, //date
DELETE = 3, //delete
DIR = 4, //dir
EDIT = 5, //edit
EXEC = 6, //exec
EXIT = 7, //exit
MKDIR = 8, //mkdir
RENAME = 9, //rename
RMDIR = 10, //rmdir
TIME = 11, //time
PRODUCER = 12, // producer-consumer program
CONSUMER = 13;
private final static String[] spellings = {
"attrib", "copy", "date", "delete", "dir", "edit", "exec",
"exit", "mkdir", "rename", "rmdir", "time","prod","consum"
};
}