01: package ro.infoiasi.donald.compiler.lexer;
02:
03: class OperatorToken extends ExpToken implements Comparable {
04: private Operator op;
05:
06: OperatorToken(int strIndex, int tokenNo, Operator op) {
07: super (strIndex, tokenNo);
08: this .op = op;
09: }
10:
11: public Operator operator() {
12: return op;
13: }
14:
15: public int compareTo(Object obj) {
16: if (obj == null) {
17: throw new NullPointerException();
18: }
19: return op.compareTo(((OperatorToken) obj).op);
20: }
21:
22: public String toString() {
23: return "" + op.getSymbol();
24: }
25: }
|