KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > CommonASTWithHiddenTokens


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 /** A CommonAST whose initialization copies hidden token
10  * information from the Token used to create a node.
11  */

12 public class CommonASTWithHiddenTokens extends CommonAST {
13     protected CommonHiddenStreamToken hiddenBefore, hiddenAfter; // references to hidden tokens
14

15     public CommonASTWithHiddenTokens() {
16         super();
17     }
18
19     public CommonASTWithHiddenTokens(Token tok) {
20         super(tok);
21     }
22
23     public CommonHiddenStreamToken getHiddenAfter() {
24         return hiddenAfter;
25     }
26
27     public CommonHiddenStreamToken getHiddenBefore() {
28         return hiddenBefore;
29     }
30
31     public void initialize(Token tok) {
32         CommonHiddenStreamToken t = (CommonHiddenStreamToken)tok;
33         super.initialize(t);
34         hiddenBefore = t.getHiddenBefore();
35         hiddenAfter = t.getHiddenAfter();
36     }
37 }
38
Popular Tags