//==============================================================================
// VariableReferenceNode.java
//==============================================================================
package sample.visitor;
/**
* Responsibilities:
* - represents a variable reference in a program.
*
*
* @author Copyright 2003 Nikolas S. Boyd.
*/
public class VariableReferenceNode extends Node {
/**
* Responsibilities:
* - visits a variable reference node in a program AST.
*
*
* @author Copyright 2003 Nikolas S. Boyd.
*/
public interface Visitor {
/**
* Visits a variable reference node.
* @param node represents a node in a program AST.
*/
public void visit(VariableReferenceNode node);
} // VariableReferenceNode.Vistor
/**
* Accepts a node visitor for this kind of AST node.
* @param visitor knows what to do with a variable reference.
*/
public void accept(Visitor visitor) {
visitor.visit(this);
return;
}
/**
* Accepts a node visitor for this kind of AST node.
* @param visitor must know how to visit this kind of node.
*/
public void accept(Node.Visitor visitor) {
accept((Visitor) visitor);
return;
}
// ... other aspects of the variable reference node ...
} // VariableReferenceNode