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: /** A TreeElement is a block with one alternative and a root node */
10: class TreeElement extends AlternativeBlock {
11: GrammarAtom root;
12:
13: public TreeElement(Grammar g, Token start) {
14: super (g, start, false);
15: }
16:
17: public void generate() {
18: grammar.generator.gen(this );
19: }
20:
21: public Lookahead look(int k) {
22: return grammar.theLLkAnalyzer.look(k, this );
23: }
24:
25: public String toString() {
26: String s = " #(" + root;
27: Alternative a = (Alternative) alternatives.elementAt(0);
28: AlternativeElement p = a.head;
29: while (p != null) {
30: s += p;
31: p = p.next;
32: }
33: return s + " )";
34: }
35: }
|