KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > CommonToken


1 package persistence.antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/license.html
6  *
7  */

8
9 public class CommonToken extends Token {
10     // most tokens will want line and text information
11
protected int line;
12     protected String JavaDoc text = null;
13     protected int col;
14
15     public CommonToken() {
16     }
17
18     public CommonToken(int t, String JavaDoc txt) {
19         type = t;
20         setText(txt);
21     }
22
23     public CommonToken(String JavaDoc s) {
24         text = s;
25     }
26
27     public int getLine() {
28         return line;
29     }
30
31     public String JavaDoc getText() {
32         return text;
33     }
34
35     public void setLine(int l) {
36         line = l;
37     }
38
39     public void setText(String JavaDoc s) {
40         text = s;
41     }
42
43     public String JavaDoc toString() {
44         return "[\"" + getText() + "\",<" + type + ">,line=" + line + ",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 }
56
Popular Tags