01: package persistence.antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.jGuru.com
05: * Software rights: http://www.antlr.org/license.html
06: *
07: */
08:
09: /** A token is minimally a token type. Subclasses can add the text matched
10: * for the token and line info.
11: */
12: public class Token implements Cloneable {
13: // constants
14: public static final int MIN_USER_TYPE = 4;
15: public static final int NULL_TREE_LOOKAHEAD = 3;
16: public static final int INVALID_TYPE = 0;
17: public static final int EOF_TYPE = 1;
18: public static final int SKIP = -1;
19:
20: // each Token has at least a token type
21: int type = INVALID_TYPE;
22:
23: // the illegal token object
24: public static Token badToken = new Token(INVALID_TYPE, "<no text>");
25:
26: public Token() {
27: }
28:
29: public Token(int t) {
30: type = t;
31: }
32:
33: public Token(int t, String txt) {
34: type = t;
35: setText(txt);
36: }
37:
38: public int getColumn() {
39: return 0;
40: }
41:
42: public int getLine() {
43: return 0;
44: }
45:
46: public String getFilename() {
47: return null;
48: }
49:
50: public void setFilename(String name) {
51: }
52:
53: public String getText() {
54: return "<no text>";
55: }
56:
57: public void setText(String t) {
58: }
59:
60: public void setColumn(int c) {
61: }
62:
63: public void setLine(int l) {
64: }
65:
66: public int getType() {
67: return type;
68: }
69:
70: public void setType(int t) {
71: type = t;
72: }
73:
74: public String toString() {
75: return "[\"" + getText() + "\",<" + type + ">]";
76: }
77: }
|