01: package antlr;
02:
03: /* ANTLR Translator Generator
04: * Project led by Terence Parr at http://www.cs.usfca.edu
05: * Software rights: http://www.antlr.org/license.html
06: */
07:
08: import antlr.collections.impl.Vector;
09:
10: class RuleSymbol extends GrammarSymbol {
11: RuleBlock block; // list of alternatives
12: boolean defined; // has the rule been defined yet?
13: Vector references; // list of all nodes referencing this rule
14: // not strictly needed by generic symbol table
15: // but we will almost always analyze/gen code
16: String access; // access specifier for this rule
17: String comment; // A javadoc comment if any.
18:
19: public RuleSymbol(String r) {
20: super (r);
21: references = new Vector();
22: }
23:
24: public void addReference(RuleRefElement e) {
25: references.appendElement(e);
26: }
27:
28: public RuleBlock getBlock() {
29: return block;
30: }
31:
32: public RuleRefElement getReference(int i) {
33: return (RuleRefElement) references.elementAt(i);
34: }
35:
36: public boolean isDefined() {
37: return defined;
38: }
39:
40: public int numReferences() {
41: return references.size();
42: }
43:
44: public void setBlock(RuleBlock rb) {
45: block = rb;
46: }
47:
48: public void setDefined() {
49: defined = true;
50: }
51: }
|