KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > persistence > antlr > RuleSymbol


1 package persistence.antlr;
2
3 /* ANTLR Translator Generator
4  * Project led by Terence Parr at http://www.jGuru.com
5  * Software rights: http://www.antlr.org/license.html
6  *
7  */

8
9 import persistence.antlr.collections.impl.Vector;
10
11 class RuleSymbol extends GrammarSymbol {
12     RuleBlock block; // list of alternatives
13
boolean defined; // has the rule been defined yet?
14
Vector references; // list of all nodes referencing this rule
15
// not strictly needed by generic symbol table
16
// but we will almost always analyze/gen code
17
String JavaDoc access; // access specifier for this rule
18
String JavaDoc comment; // A javadoc comment if any.
19

20     public RuleSymbol(String JavaDoc r) {
21         super(r);
22         references = new Vector();
23     }
24
25     public void addReference(RuleRefElement e) {
26         references.appendElement(e);
27     }
28
29     public RuleBlock getBlock() {
30         return block;
31     }
32
33     public RuleRefElement getReference(int i) {
34         return (RuleRefElement)references.elementAt(i);
35     }
36
37     public boolean isDefined() {
38         return defined;
39     }
40
41     public int numReferences() {
42         return references.size();
43     }
44
45     public void setBlock(RuleBlock rb) {
46         block = rb;
47     }
48
49     public void setDefined() {
50         defined = true;
51     }
52 }
53
Popular Tags