1 package persistence.antlr; 2 3 8 9 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 } 36 | Popular Tags |