|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.umlv.tatoo.runtime.parser.ParserErrorRecoveryPolicy<T,N,P,V>
fr.umlv.tatoo.runtime.parser.DefaultParserErrorRecoveryPolicy<T,N,P,V>
T - type of terminals.N - type of non-terminals.P - type of productions.V - type of versions.public class DefaultParserErrorRecoveryPolicy<T,N,P,V>
Error recover policy that try to recover ... An instance of this policy must be associated to only one parser because it owns an error state specific to a parser. It use an error recovery listener to inform that during recover phase some terminal or non terminal must be discarded in order to recover.
| Constructor Summary | |
|---|---|
DefaultParserErrorRecoveryPolicy(ParserErrorRecoveryListener<? super T,? super N> errorRecoveryListener)
Creates the recover policy with a listener to signal when pop terminal and non terminal during a recover phase. |
|
| Method Summary | |
|---|---|
boolean |
closeParser(Parser<T,N,P,V> parser)
Notifies that the parser is closing and an error was notified by ParserErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.parser.Parser
returning ActionReturn.NEXT_ERROR. |
ActionReturn |
continueRecoverOnError(Parser<T,N,P,V> parser,
IntArrayList states,
T terminal)
Called when error recovery was initiated by recover on error, and method ParserErrorRecoveryPolicy.errorRecoveryNeedsContinuation()
returns true |
boolean |
errorRecoveryNeedsContinuation()
Indicate if ParserErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.parser.Parser needs to be called by processor |
Set<? extends T> |
getLookahead(Parser<T,N,P,V> parser,
Set<? extends T> proposedLookaheads)
Returns the lookahead set of terminals that the parser should accept as input of next Parser.step(). |
ActionReturn |
recoverOnError(Parser<T,N,P,V> parser,
IntArrayList states,
T terminal,
String message)
Tries to recover on an error. |
void |
reset()
Reset the error recovery policy. |
| Methods inherited from class fr.umlv.tatoo.runtime.parser.ParserErrorRecoveryPolicy |
|---|
getNoErrorRecoveryPolicy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultParserErrorRecoveryPolicy(ParserErrorRecoveryListener<? super T,? super N> errorRecoveryListener)
errorRecoveryListener - the listener.| Method Detail |
|---|
public ActionReturn recoverOnError(Parser<T,N,P,V> parser,
IntArrayList states,
T terminal,
String message)
ParserErrorRecoveryPolicytrue
if error recovery started and/or succeeded, false
if lexer must skip some input. This method may
throw a ParseException to signify a fatal error.
recoverOnError in class ParserErrorRecoveryPolicy<T,N,P,V>parser - the parser.states - the state stack of the parser.terminal - the terminal that caused the error or null
if no terminal is available.
NEXT if lexer must skip some input.
public ActionReturn continueRecoverOnError(Parser<T,N,P,V> parser,
IntArrayList states,
T terminal)
ParserErrorRecoveryPolicyParserErrorRecoveryPolicy.errorRecoveryNeedsContinuation()
returns true
continueRecoverOnError in class ParserErrorRecoveryPolicy<T,N,P,V>parser - the parser.states - the state stack of the parser.terminal - current terminal, argument of
Parser.step(terminal) or null.
NEXT if the terminal must be skipped by the parser,
KEEP otherwise.public boolean closeParser(Parser<T,N,P,V> parser)
ParserErrorRecoveryPolicyParserErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.parser.Parser, fr.umlv.tatoo.runtime.util.IntArrayList, T)
returning ActionReturn.NEXT_ERROR.
This method is called in Parser.close().
closeParser in class ParserErrorRecoveryPolicy<T,N,P,V>parser - the parser.
Parser.close()
public Set<? extends T> getLookahead(Parser<T,N,P,V> parser,
Set<? extends T> proposedLookaheads)
ParserErrorRecoveryPolicyParser.step().
getLookahead in class ParserErrorRecoveryPolicy<T,N,P,V>parser - the parser.proposedLookaheads - the lookahead set of terminal
of current parser state when there is no error.
null
for all terminals.public void reset()
ParserErrorRecoveryPolicy
reset in class ParserErrorRecoveryPolicy<T,N,P,V>Parser.reset(Object)public boolean errorRecoveryNeedsContinuation()
ParserErrorRecoveryPolicyParserErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.parser.Parser, fr.umlv.tatoo.runtime.util.IntArrayList, T) needs to be called by processor
errorRecoveryNeedsContinuation in class ParserErrorRecoveryPolicy<T,N,P,V>ParserErrorRecoveryPolicy.continueRecoverOnError(fr.umlv.tatoo.runtime.parser.Parser, fr.umlv.tatoo.runtime.util.IntArrayList, T) needs to be called by processor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||