net.sourceforge.nrl.parser.ast.impl
Class AntlrOperatorResolverVisitor

java.lang.Object
  extended by net.sourceforge.nrl.parser.ast.impl.AntlrOperatorResolverVisitor
All Implemented Interfaces:
INRLAstVisitor

public class AntlrOperatorResolverVisitor
extends Object
implements INRLAstVisitor

An implementation of an operator resolver.

This class traverses an AST, and resolves references to operators in all IOperatorInvocation nodes it finds. To use it, pass it to the accept method on a rule file.

It produces a list of errors that can be retrieved using getErrors(). This will contain SemanticError objects for missing operators or parameter mismatches.

Author:
Christian Nentwich

Field Summary
protected  List<NRLError> errors
           
protected  IOperators[] operators
           
 
Constructor Summary
AntlrOperatorResolverVisitor(IOperators[] operators)
          Create a new operator visitor with the collection to resolve against.
 
Method Summary
 List<NRLError> getErrors()
          Return the list of errors, after traversal.
 void visitAfter(INRLAstNode node)
          Visit an AST node after its children have been processed.
 boolean visitBefore(INRLAstNode node)
          Visit an AST node and, if this method returns true, visit its children in order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errors

protected List<NRLError> errors

operators

protected IOperators[] operators
Constructor Detail

AntlrOperatorResolverVisitor

public AntlrOperatorResolverVisitor(IOperators[] operators)
Create a new operator visitor with the collection to resolve against.

Parameters:
operators - the operator collection
Method Detail

getErrors

public List<NRLError> getErrors()
Return the list of errors, after traversal.

Returns:
a list of SemanticError objects.

visitBefore

public boolean visitBefore(INRLAstNode node)
Description copied from interface: INRLAstVisitor
Visit an AST node and, if this method returns true, visit its children in order.

Specified by:
visitBefore in interface INRLAstVisitor
Parameters:
node - the AST node
Returns:
true if the children should be visited

visitAfter

public void visitAfter(INRLAstNode node)
Description copied from interface: INRLAstVisitor
Visit an AST node after its children have been processed. This is always called after INRLAstVisitor.visitBefore(INRLAstNode) by the AST.

Specified by:
visitAfter in interface INRLAstVisitor
Parameters:
node - the node to visit


Copyright © 2006-2013. All Rights Reserved.