KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > ParseTreeToken


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 import persistence.antlr.Token;
9 import persistence.antlr.collections.AST;
10
11 public class ParseTreeToken extends ParseTree {
12     protected Token token;
13
14     public ParseTreeToken(Token token) {
15         this.token = token;
16     }
17
18     protected int getLeftmostDerivation(StringBuffer JavaDoc buf, int step) {
19         buf.append(' ');
20         buf.append(toString());
21         return step; // did on replacements
22
}
23
24     public String JavaDoc toString() {
25         if ( token!=null ) {
26             return token.getText();
27         }
28         return "<missing token>";
29     }
30 }
31
Popular Tags