01: package persistence.antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.jGuru.com
05: * Software rights: http://www.antlr.org/license.html
06: *
07: */
08:
09: 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 access; // access specifier for this rule
18: String comment; // A javadoc comment if any.
19:
20: public RuleSymbol(String 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: }
|