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