org.jaitools.jiffle.parser
Class ErrorHandlingTreeParser

java.lang.Object
  extended by org.antlr.runtime.BaseRecognizer
      extended by org.antlr.runtime.tree.TreeParser
          extended by org.jaitools.jiffle.parser.ErrorHandlingTreeParser
Direct Known Subclasses:
AbstractSourceGenerator

public abstract class ErrorHandlingTreeParser
extends org.antlr.runtime.tree.TreeParser

A base class for Jiffle tree parsers that want to intercept ANTLR error and warning messages.

Since:
0.1
Version:
$Id: ErrorHandlingTreeParser.java 1653 2011-06-16 10:23:02Z michael.bedward $
Author:
Michael Bedward

Field Summary
protected  ParsingErrorReporter errorReporter
          Stores error and warning messages.
 
Fields inherited from class org.antlr.runtime.tree.TreeParser
DOWN, input, UP
 
Fields inherited from class org.antlr.runtime.BaseRecognizer
DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
 
Constructor Summary
ErrorHandlingTreeParser(org.antlr.runtime.tree.TreeNodeStream input)
          Constructor.
ErrorHandlingTreeParser(org.antlr.runtime.tree.TreeNodeStream input, org.antlr.runtime.RecognizerSharedState state)
          Constructor.
 
Method Summary
 void emitErrorMessage(java.lang.String msg)
          Overrides the ANTLR parser method to capture an error message that would otherwise be sent to std err.
 ParsingErrorReporter getErrorReporter()
          Gets the error reporter object.
 void setErrorReporter(ParsingErrorReporter er)
          Sets the error reporter.
 
Methods inherited from class org.antlr.runtime.tree.TreeParser
getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStream, traceIn, traceOut
 
Methods inherited from class org.antlr.runtime.BaseRecognizer
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, endResync, failed, getBacktrackingLevel, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, reportError, setBacktrackingLevel, toStrings, traceIn, traceOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorReporter

protected ParsingErrorReporter errorReporter
Stores error and warning messages.

Constructor Detail

ErrorHandlingTreeParser

public ErrorHandlingTreeParser(org.antlr.runtime.tree.TreeNodeStream input)
Constructor.

Parameters:
input - AST node stream

ErrorHandlingTreeParser

public ErrorHandlingTreeParser(org.antlr.runtime.tree.TreeNodeStream input,
                               org.antlr.runtime.RecognizerSharedState state)
Constructor.

Parameters:
input - input AST node stream
state - recognizer state
Method Detail

emitErrorMessage

public void emitErrorMessage(java.lang.String msg)
Overrides the ANTLR parser method to capture an error message that would otherwise be sent to std err.

Overrides:
emitErrorMessage in class org.antlr.runtime.BaseRecognizer
Parameters:
msg - the message

getErrorReporter

public ParsingErrorReporter getErrorReporter()
Gets the error reporter object.

Returns:
the error reporter

setErrorReporter

public void setErrorReporter(ParsingErrorReporter er)
Sets the error reporter.

Parameters:
er - the error reporter (may be null if message interception is not required).


Copyright © 2011. All Rights Reserved.