01: //
02: // Generated by JTB 1.2.2
03: //
04:
05: package xtc.lang.javacc.syntaxtree;
06:
07: /**
08: * Represents an grammar optional node, e.g. ( A )? or [ A ].
09: */
10: public class NodeOptional implements Node {
11: public NodeOptional() {
12: node = null;
13: }
14:
15: public NodeOptional(Node n) {
16: addNode(n);
17: }
18:
19: public void addNode(Node n) {
20: if (node != null) // Oh oh!
21: throw new Error("Attempt to set optional node twice");
22:
23: node = n;
24: }
25:
26: public void accept(xtc.lang.javacc.visitor.Visitor v) {
27: v.visit(this );
28: }
29:
30: public Object accept(xtc.lang.javacc.visitor.ObjectVisitor v,
31: Object argu) {
32: return v.visit(this , argu);
33: }
34:
35: public boolean present() {
36: return node != null;
37: }
38:
39: public Node node;
40: }
|