01: package antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: public class CommonToken extends TokenImpl {
09: // most tokens will want line and text information
10: protected int line;
11: protected String text = null;
12: protected int col;
13:
14: public CommonToken() {
15: }
16:
17: public CommonToken(int t, String txt) {
18: type = t;
19: setText(txt);
20: }
21:
22: public CommonToken(String s) {
23: text = s;
24: }
25:
26: public int getLine() {
27: return line;
28: }
29:
30: public String getText() {
31: return text;
32: }
33:
34: public void setLine(int l) {
35: line = l;
36: }
37:
38: public void setText(String s) {
39: text = s;
40: }
41:
42: public String toString() {
43: return "[\"" + getText() + "\",<" + type + ">,line=" + line
44: + ",col=" + col + "]";
45: }
46:
47: /** Return token's start column */
48: public int getColumn() {
49: return col;
50: }
51:
52: public void setColumn(int c) {
53: col = c;
54: }
55: }
|