-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGroup.java
39 lines (27 loc) · 949 Bytes
/
Group.java
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
/*
* Ethan Mines
* CS503 - Lusth
*/
import java.util.Set;
import java.util.HashSet;
import java.util.Arrays;
public final class Group {
public static final Group UNARY = new Group("unary operator",
Type.UMINUS, Type.NOT
);
public static final Group BINARY = new Group("binary operator",
Type.PLUS, Type.MINUS, Type.TIMES, Type.DIV, Type.MOD,
Type.LT, Type.LTE, Type.NEQ, Type.EQ, Type.GTE, Type.GT,
Type.ASSIGN, Type.DOT, Type.AND, Type.OR);
public static final Group BINARY_1 = new Group("binary operator",
Type.PLUS, Type.MINUS, Type.TIMES, Type.DIV, Type.MOD,
Type.LT, Type.LTE, Type.NEQ, Type.EQ, Type.GTE, Type.GT,
/*Type.ASSIGN,*/ Type.DOT, Type.AND, Type.OR);
public boolean contains(Type t) { return terminals.contains(t); }
public final String name;
public final Set<Type> terminals;
private Group(String name, Type... l) {
this.name = name;
this.terminals = new HashSet<>(Arrays.asList(l));
}
}