1 package antlr; 2 3 9 10 11 class TreeElement extends AlternativeBlock { 12 GrammarAtom root; 13 14 public TreeElement(Grammar g, Token start) { 15 super(g, start, false); 16 } 17 18 public void generate() { 19 grammar.generator.gen(this); 20 } 21 22 public Lookahead look(int k) { 23 return grammar.theLLkAnalyzer.look(k, this); 24 } 25 26 public String toString() { 27 String s = " #(" + root; 28 Alternative a = (Alternative)alternatives.elementAt(0); 29 AlternativeElement p = a.head; 30 while (p != null) { 31 s += p; 32 p = p.next; 33 } 34 return s + " )"; 35 } 36 } 37 | Popular Tags |