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: import antlr.collections.AST;
09:
10: /** A CommonAST whose initialization copies hidden token
11: * information from the Token used to create a node.
12: */
13: public class CommonASTWithHiddenTokens extends CommonAST {
14: protected CommonHiddenStreamToken hiddenBefore, hiddenAfter; // references to hidden tokens
15:
16: public CommonASTWithHiddenTokens() {
17: super ();
18: }
19:
20: public CommonASTWithHiddenTokens(Token tok) {
21: super (tok);
22: }
23:
24: public CommonHiddenStreamToken getHiddenAfter() {
25: return hiddenAfter;
26: }
27:
28: public CommonHiddenStreamToken getHiddenBefore() {
29: return hiddenBefore;
30: }
31:
32: public void initialize(AST t) {
33: hiddenBefore = ((CommonASTWithHiddenTokens) t)
34: .getHiddenBefore();
35: hiddenAfter = ((CommonASTWithHiddenTokens) t).getHiddenAfter();
36: super .initialize(t);
37: }
38:
39: public void initialize(Token tok) {
40: CommonHiddenStreamToken t = (CommonHiddenStreamToken) tok;
41: super.initialize(t);
42: hiddenBefore = t.getHiddenBefore();
43: hiddenAfter = t.getHiddenAfter();
44: }
45: }
|