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: import persistence.antlr.collections.AST;
10:
11: /** Common AST node implementation */
12: public class CommonAST extends BaseAST {
13: int ttype = Token.INVALID_TYPE;
14: String text;
15:
16: /** Get the token text for this node */
17: public String getText() {
18: return text;
19: }
20:
21: /** Get the token type for this node */
22: public int getType() {
23: return ttype;
24: }
25:
26: public void initialize(int t, String txt) {
27: setType(t);
28: setText(txt);
29: }
30:
31: public void initialize(AST t) {
32: setText(t.getText());
33: setType(t.getType());
34: }
35:
36: public CommonAST() {
37: }
38:
39: public CommonAST(Token tok) {
40: initialize(tok);
41: }
42:
43: public void initialize(Token tok) {
44: setText(tok.getText());
45: setType(tok.getType());
46: }
47:
48: /** Set the token text for this node */
49: public void setText(String text_) {
50: text = text_;
51: }
52:
53: /** Set the token type for this node */
54: public void setType(int ttype_) {
55: ttype = ttype_;
56: }
57: }
|