KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > antlr > ActionElement


1 package antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/RIGHTS.html
6  *
7  * $Id: //depot/code/org.antlr/main/main/antlr/ActionElement.java#5 $
8  */

9
10 class ActionElement extends AlternativeElement {
11     protected String JavaDoc actionText;
12     protected boolean isSemPred = false;
13
14
15     public ActionElement(Grammar g, Token t) {
16         super(g);
17         actionText = t.getText();
18         line = t.getLine();
19         column = t.getColumn();
20     }
21
22     public void generate() {
23         grammar.generator.gen(this);
24     }
25
26     public Lookahead look(int k) {
27         return grammar.theLLkAnalyzer.look(k, this);
28     }
29
30     public String JavaDoc toString() {
31         return " " + actionText + (isSemPred?"?":"");
32     }
33 }
34
Popular Tags