fr.umlv.tatoo.runtime.lexer
Class DefaultLexerErrorRecoveryPolicy<R,B extends LexerBuffer>

java.lang.Object
  extended by fr.umlv.tatoo.runtime.lexer.DefaultLexerErrorRecoveryPolicy<R,B>
All Implemented Interfaces:
LexerErrorRecoveryPolicy<R,B>

public class DefaultLexerErrorRecoveryPolicy<R,B extends LexerBuffer>
extends Object
implements LexerErrorRecoveryPolicy<R,B>


Constructor Summary
DefaultLexerErrorRecoveryPolicy(ErrorForwarder<B> errorForwarder, LexerWarningReporter<B> warningReporter)
           
 
Method Summary
 ProcessReturn continueRecoverOnError(Lexer<B> lexer, ActionProcessor<R> processor)
          Called when error recovery was initiated by recover on error, and method LexerErrorRecoveryPolicy.errorRecoveryNeedsContinuation() returns true
 ProcessReturn continueRecoverOnUnexpectedEndOfFile(Lexer<B> lexer, ActionProcessor<R> processor)
          Called when error recovery was initiated by recover on error, and method LexerErrorRecoveryPolicy.unexpectedEndOfFileRecoveryNeedsContinuation() returns true
 boolean errorRecoveryNeedsContinuation()
          Indicate if LexerErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor
 void recoverOnError(Lexer<B> lexer, ActionProcessor<R> processor)
          Called when the impossible match first occurs.
 void recoverOnUnexpectedEndOfFile(Lexer<B> lexer, ActionProcessor<R> processor)
          Called when the impossible match first occurs at end of input.
 boolean unexpectedEndOfFileRecoveryNeedsContinuation()
          Indicate if LexerErrorRecoveryPolicy.continueRecoverOnUnexpectedEndOfFile(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLexerErrorRecoveryPolicy

public DefaultLexerErrorRecoveryPolicy(ErrorForwarder<B> errorForwarder,
                                       LexerWarningReporter<B> warningReporter)
Parameters:
errorForwarder -
warningReporter - may be null.
Method Detail

recoverOnError

public void recoverOnError(Lexer<B> lexer,
                           ActionProcessor<R> processor)
Description copied from interface: LexerErrorRecoveryPolicy
Called when the impossible match first occurs. If necessary, LexerErrorRecoveryPolicy.errorRecoveryNeedsContinuation() returns true and LexerErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) is called

Specified by:
recoverOnError in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
processor - the action processor

continueRecoverOnError

public ProcessReturn continueRecoverOnError(Lexer<B> lexer,
                                            ActionProcessor<R> processor)
Description copied from interface: LexerErrorRecoveryPolicy
Called when error recovery was initiated by recover on error, and method LexerErrorRecoveryPolicy.errorRecoveryNeedsContinuation() returns true

Specified by:
continueRecoverOnError in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
Parameters:
lexer - the lexer
processor - the action processor
Returns:
MORE if more characters are needed, ERROR, if error recovery fails and TOKEN if a new token is spawned.

errorRecoveryNeedsContinuation

public boolean errorRecoveryNeedsContinuation()
Description copied from interface: LexerErrorRecoveryPolicy
Indicate if LexerErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor

Specified by:
errorRecoveryNeedsContinuation in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
Returns:
true if LexerErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor

continueRecoverOnUnexpectedEndOfFile

public ProcessReturn continueRecoverOnUnexpectedEndOfFile(Lexer<B> lexer,
                                                          ActionProcessor<R> processor)
Description copied from interface: LexerErrorRecoveryPolicy
Called when error recovery was initiated by recover on error, and method LexerErrorRecoveryPolicy.unexpectedEndOfFileRecoveryNeedsContinuation() returns true

Specified by:
continueRecoverOnUnexpectedEndOfFile in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
processor - the action processor
Returns:
MORE if more characters are needed, ERROR, if error recovery fails and TOKEN if a new token is spawned.

recoverOnUnexpectedEndOfFile

public void recoverOnUnexpectedEndOfFile(Lexer<B> lexer,
                                         ActionProcessor<R> processor)
Description copied from interface: LexerErrorRecoveryPolicy
Called when the impossible match first occurs at end of input. If necessary, LexerErrorRecoveryPolicy.unexpectedEndOfFileRecoveryNeedsContinuation() returns true and LexerErrorRecoveryPolicy.continueRecoverOnUnexpectedEndOfFile(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) is called

Specified by:
recoverOnUnexpectedEndOfFile in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
processor - the action processor

unexpectedEndOfFileRecoveryNeedsContinuation

public boolean unexpectedEndOfFileRecoveryNeedsContinuation()
Description copied from interface: LexerErrorRecoveryPolicy
Indicate if LexerErrorRecoveryPolicy.continueRecoverOnUnexpectedEndOfFile(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor

Specified by:
unexpectedEndOfFileRecoveryNeedsContinuation in interface LexerErrorRecoveryPolicy<R,B extends LexerBuffer>
Returns:
true if LexerErrorRecoveryPolicy.continueRecoverOnUnexpectedEndOfFile(fr.umlv.tatoo.runtime.lexer.Lexer, fr.umlv.tatoo.runtime.lexer.rules.ActionProcessor) needs to be called by processor