org.lsmp.djep.xjep
Class ErrorCatchingVisitor

java.lang.Object
  extended byorg.lsmp.djep.xjep.DoNothingVisitor
      extended byorg.lsmp.djep.xjep.ErrorCatchingVisitor
All Implemented Interfaces:
ParserVisitor
Direct Known Subclasses:
PrintVisitor

public abstract class ErrorCatchingVisitor
extends DoNothingVisitor

An abstract ParserVisitor which adds some useful error handeling facilities. Visitors which require these facilities should extend this class. General format should be

  
 	clearErrors();
	Object res = (Node) node.jjtAccept(this,data);
	if(hasErrors())
		throw new ParseException(getErrors());

Author:
Rich Morris Created on 19-Jun-2003

Constructor Summary
ErrorCatchingVisitor()
           
 
Method Summary
 java.lang.Object acceptCatchingErrors(Node node, java.lang.Object data)
          calls jjtAccept inside a try catch block, adding the error if necessary
 void addError(java.lang.Exception e)
          Adds an error message to the list of errors.
 void clearErrors()
          Reset the list of errors.
 java.lang.Exception getError()
          Returns the Exception or null if no error.
 java.lang.String getErrorsMessage()
          Returns the error messages.
 boolean hasErrors()
          Are their any errors?
 
Methods inherited from class org.lsmp.djep.xjep.DoNothingVisitor
acceptChildrenAsArray, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorCatchingVisitor

public ErrorCatchingVisitor()
Method Detail

acceptCatchingErrors

public java.lang.Object acceptCatchingErrors(Node node,
                                             java.lang.Object data)
calls jjtAccept inside a try catch block, adding the error if necessary


clearErrors

public void clearErrors()
Reset the list of errors.


hasErrors

public boolean hasErrors()
Are their any errors?


addError

public void addError(java.lang.Exception e)
Adds an error message to the list of errors.


getErrorsMessage

public java.lang.String getErrorsMessage()
Returns the error messages.


getError

public java.lang.Exception getError()
Returns the Exception or null if no error.



http://www.singularsys.com/jep Copyright © 2004 Singular Systems