@Override
protected void reportNoViableAlternative(Parser recognizer, NoViableAltException e) {
// change error message from default implementation
TokenStream tokens = recognizer.getInputStream();
String input;
if (tokens != null) {
if (e.getStartToken().getType() == Token.EOF) {
input = "the end";
} else {
input = escapeWSAndQuote(tokens.getText(e.getStartToken(), e.getOffendingToken()));
}
} else {
input = escapeWSAndQuote("<unknown input>");
}
String msg = "inadmissible input at " + input;
recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e);
}
java类org.antlr.v4.runtime.NoViableAltException的实例源码
CapitulatingErrorStrategy.java 文件源码
项目:rapidminer
阅读 26
收藏 0
点赞 0
评论 0
ParserErrorStrategy.java 文件源码
项目:elasticsearch_my
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void recover(final Parser recognizer, final RecognitionException re) {
final Token token = re.getOffendingToken();
String message;
if (token == null) {
message = "no parse token found.";
} else if (re instanceof InputMismatchException) {
message = "unexpected token [" + getTokenErrorDisplay(token) + "]" +
" was expecting one of [" + re.getExpectedTokens().toString(recognizer.getVocabulary()) + "].";
} else if (re instanceof NoViableAltException) {
if (token.getType() == PainlessParser.EOF) {
message = "unexpected end of script.";
} else {
message = "invalid sequence of tokens near [" + getTokenErrorDisplay(token) + "].";
}
} else {
message = "unexpected token near [" + getTokenErrorDisplay(token) + "].";
}
Location location = new Location(sourceName, token == null ? -1 : token.getStartIndex());
throw location.createError(new IllegalArgumentException(message, re));
}
KsqlParserErrorStrategy.java 文件源码
项目:ksql
阅读 22
收藏 0
点赞 0
评论 0
public void reportError(Parser recognizer, RecognitionException e) {
if (!this.inErrorRecoveryMode(recognizer)) {
this.beginErrorCondition(recognizer);
if (e instanceof NoViableAltException) {
this.reportNoViableAlternative(recognizer, (NoViableAltException) e);
} else if (e instanceof InputMismatchException) {
this.reportInputMismatch(recognizer, (InputMismatchException) e);
} else if (e instanceof FailedPredicateException) {
this.reportFailedPredicate(recognizer, (FailedPredicateException) e);
} else {
System.err.println("unknown recognition error type: " + e.getClass().getName());
recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
}
}
}
KsqlParserErrorStrategy.java 文件源码
项目:ksql
阅读 25
收藏 0
点赞 0
评论 0
protected void reportNoViableAlternative(Parser recognizer, NoViableAltException e) {
TokenStream tokens = recognizer.getInputStream();
String input;
if (tokens != null) {
if (e.getStartToken().getType() == -1) {
input = "<EOF>";
} else {
input = tokens.getText(e.getStartToken(), e.getOffendingToken());
}
} else {
input = "<unknown input>";
}
String msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e);
}
CapitulatingErrorStrategy.java 文件源码
项目:rapidminer-studio
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected void reportNoViableAlternative(Parser recognizer, NoViableAltException e) {
// change error message from default implementation
TokenStream tokens = recognizer.getInputStream();
String input;
if (tokens != null) {
if (e.getStartToken().getType() == Token.EOF) {
input = "the end";
} else {
input = escapeWSAndQuote(tokens.getText(e.getStartToken(), e.getOffendingToken()));
}
} else {
input = escapeWSAndQuote("<unknown input>");
}
String msg = "inadmissible input at " + input;
recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e);
}
CQLErrorStrategy.java 文件源码
项目:StreamCQL
阅读 23
收藏 0
点赞 0
评论 0
/**
* {@inheritDoc}
*/
@Override
public void reportNoViableAlternative(@NotNull Parser recognizer, @NotNull NoViableAltException e)
{
TokenStream tokens = recognizer.getInputStream();
String input;
if (tokens instanceof TokenStream)
{
if (e.getStartToken().getType() == Token.EOF)
input = "<EOF>";
else
input = getText(tokens, e.getStartToken(), e.getOffendingToken());
}
else
{
input = "<unknown input>";
}
String msg = "no viable alternative at input " + escapeWSAndQuote(input);
recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e);
}
DescriptiveErrorStrategy.java 文件源码
项目:groovy
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void recover(Parser recognizer, RecognitionException e) {
for (ParserRuleContext context = recognizer.getContext(); context != null; context = context.getParent()) {
context.exception = e;
}
if (PredictionMode.LL.equals(recognizer.getInterpreter().getPredictionMode())) {
if (e instanceof NoViableAltException) {
this.reportNoViableAlternative(recognizer, (NoViableAltException) e);
} else if (e instanceof InputMismatchException) {
this.reportInputMismatch(recognizer, (InputMismatchException) e);
} else if (e instanceof FailedPredicateException) {
this.reportFailedPredicate(recognizer, (FailedPredicateException) e);
}
}
throw new ParseCancellationException(e);
}
ParserATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 25
收藏 0
点赞 0
评论 0
/** Used for debugging in adaptivePredict around execATN but I cut
* it out for clarity now that alg. works well. We can leave this
* "dead" code for a bit.
*/
public void dumpDeadEndConfigs(@NotNull NoViableAltException nvae) {
System.err.println("dead end configs: ");
for (ATNConfig c : nvae.getDeadEndConfigs()) {
String trans = "no edges";
if ( c.state.getNumberOfTransitions()>0 ) {
Transition t = c.state.transition(0);
if ( t instanceof AtomTransition) {
AtomTransition at = (AtomTransition)t;
trans = "Atom "+getTokenName(at.label);
}
else if ( t instanceof SetTransition ) {
SetTransition st = (SetTransition)t;
boolean not = st instanceof NotSetTransition;
trans = (not?"~":"")+"Set "+st.set.toString();
}
}
System.err.println(c.toString(parser, true)+":"+trans);
}
}
ParserErrorListener.java 文件源码
项目:freelib-edtf
阅读 23
收藏 0
点赞 0
评论 0
public void syntaxError(Recognizer<?, ?> aRecognizer,
Object aOffendingSymbol, int aLine, int aCharIndex,
String aMessage, RecognitionException aException) {
ANTLRErrorStrategy errorHandler = myParser.getErrorHandler();
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(aMessage + " [" + aLine + ":" + aCharIndex + "]");
}
/*
* Setting the lexer exception in the parser since I don't see a
* getNumberOfSyntaxErrors() method in the lexer (like in antlr3) and
* the lexer's errors aren't being reported by parser's method
*
* I may just be missing the correct way this should be handled(?)
*/
if (aException instanceof LexerNoViableAltException) {
NoViableAltException exception = new NoViableAltException(myParser);
errorHandler.reportError(myParser, exception);
}
else {
errorHandler.reportError(myParser, aException);
}
}
AntlrErrorString.java 文件源码
项目:kalang
阅读 21
收藏 0
点赞 0
评论 0
public static String noViableAlt(Parser recognizer, NoViableAltException e) {
TokenStream tokens = recognizer.getInputStream();
String input = null;
if (tokens != null) {
Token startToken = e.getStartToken();
if (startToken.getType() == Token.EOF) {
input = "<EOF>";
} else {
input = tokens.getText(
startToken, e.getOffendingToken()
);
}
}
return "syntax error at input:" + input;
}
AntlrErrorString.java 文件源码
项目:kalang
阅读 20
收藏 0
点赞 0
评论 0
public static String exceptionString(Parser parser, RecognitionException ex) {
if (ex instanceof FailedPredicateException) {
return failedPredicate((FailedPredicateException) ex);
} else if (ex instanceof InputMismatchException) {
return inputMismatch((InputMismatchException) ex);
} else if (ex instanceof NoViableAltException) {
return noViableAlt(parser, (NoViableAltException) ex);
} else {
System.err.println("unknown recognition exception:" + ex);
return ex.toString();
}
}
Verilog2001Parser.java 文件源码
项目:netlist-graph
阅读 19
收藏 0
点赞 0
评论 0
public final Specparam_assignmentContext specparam_assignment() throws RecognitionException {
Specparam_assignmentContext _localctx = new Specparam_assignmentContext(_ctx, getState());
enterRule(_localctx, 126, RULE_specparam_assignment);
try {
setState(1541);
switch (_input.LA(1)) {
case Escaped_identifier:
case Simple_identifier:
enterOuterAlt(_localctx, 1);
{
setState(1536);
specparam_identifier();
setState(1537);
match(T__50);
setState(1538);
constant_mintypmax_expression();
}
break;
case T__62:
enterOuterAlt(_localctx, 2);
{
setState(1540);
pulse_control_specparam();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
Verilog2001Parser.java 文件源码
项目:netlist-graph
阅读 23
收藏 0
点赞 0
评论 0
public final Arrayed_identifierContext arrayed_identifier() throws RecognitionException {
Arrayed_identifierContext _localctx = new Arrayed_identifierContext(_ctx, getState());
enterRule(_localctx, 526, RULE_arrayed_identifier);
try {
setState(3834);
switch (_input.LA(1)) {
case Simple_identifier:
enterOuterAlt(_localctx, 1);
{
setState(3832);
simple_arrayed_identifier();
}
break;
case Escaped_identifier:
enterOuterAlt(_localctx, 2);
{
setState(3833);
escaped_arrayed_identifier();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
Verilog2001Parser.java 文件源码
项目:netlist-graph
阅读 23
收藏 0
点赞 0
评论 0
public final Hierarchical_identifierContext hierarchical_identifier() throws RecognitionException {
Hierarchical_identifierContext _localctx = new Hierarchical_identifierContext(_ctx, getState());
enterRule(_localctx, 556, RULE_hierarchical_identifier);
try {
setState(3876);
switch (_input.LA(1)) {
case Simple_identifier:
enterOuterAlt(_localctx, 1);
{
setState(3874);
simple_hierarchical_identifier();
}
break;
case Escaped_identifier:
enterOuterAlt(_localctx, 2);
{
setState(3875);
escaped_hierarchical_identifier();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
ExpressionConstraintParser.java 文件源码
项目:UMLS-Terminology-Server
阅读 20
收藏 0
点赞 0
评论 0
/**
* Expressioncomparisonoperator.
*
* @return the expressioncomparisonoperator context
* @throws RecognitionException the recognition exception
*/
public final ExpressioncomparisonoperatorContext expressioncomparisonoperator() throws RecognitionException {
ExpressioncomparisonoperatorContext _localctx = new ExpressioncomparisonoperatorContext(_ctx, getState());
enterRule(_localctx, 78, RULE_expressioncomparisonoperator);
try {
setState(423);
switch (_input.LA(1)) {
case EQUALS:
enterOuterAlt(_localctx, 1);
{
setState(420);
match(EQUALS);
}
break;
case EXCLAMATION:
enterOuterAlt(_localctx, 2);
{
{
setState(421);
match(EXCLAMATION);
setState(422);
match(EQUALS);
}
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
ExpressionConstraintParser.java 文件源码
项目:UMLS-Terminology-Server
阅读 22
收藏 0
点赞 0
评论 0
/**
* Stringcomparisonoperator.
*
* @return the stringcomparisonoperator context
* @throws RecognitionException the recognition exception
*/
public final StringcomparisonoperatorContext stringcomparisonoperator() throws RecognitionException {
StringcomparisonoperatorContext _localctx = new StringcomparisonoperatorContext(_ctx, getState());
enterRule(_localctx, 82, RULE_stringcomparisonoperator);
try {
setState(439);
switch (_input.LA(1)) {
case EQUALS:
enterOuterAlt(_localctx, 1);
{
setState(436);
match(EQUALS);
}
break;
case EXCLAMATION:
enterOuterAlt(_localctx, 2);
{
{
setState(437);
match(EXCLAMATION);
setState(438);
match(EQUALS);
}
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
ErrorHandler.java 文件源码
项目:JuliaDT
阅读 32
收藏 0
点赞 0
评论 0
@Override
protected void reportNoViableAlternative(Parser recognizer, NoViableAltException exception) {
super.reportNoViableAlternative(recognizer, exception);
final Token offendingToken = exception.getOffendingToken();
problemReporter.reportProblem(new DefaultProblem(exception.getInputStream().getSourceName(),
exception.getMessage(), JuliaProblemIdentifier.SYNTAX_ERROR, new String[] { exception
.getMessage() }, ProblemSeverity.DEFAULT, offendingToken.getStartIndex(),
offendingToken.getStopIndex(), offendingToken.getLine(), offendingToken
.getCharPositionInLine()));
}
DescriptiveErrorStrategy.java 文件源码
项目:groovy
阅读 22
收藏 0
点赞 0
评论 0
protected String createNoViableAlternativeErrorMessage(Parser recognizer, NoViableAltException e) {
TokenStream tokens = recognizer.getInputStream();
String input;
if (tokens != null) {
if (e.getStartToken().getType() == Token.EOF) {
input = "<EOF>";
} else {
input = charStream.getText(Interval.of(e.getStartToken().getStartIndex(), e.getOffendingToken().getStopIndex()));
}
} else {
input = "<unknown input>";
}
return "Unexpected input: " + escapeWSAndQuote(input);
}
SyntaxError.java 文件源码
项目:jetbrains
阅读 22
收藏 0
点赞 0
评论 0
public Token getOffendingSymbol() {
if ( e instanceof NoViableAltException ) {
// the error node in parse tree will have the start token as bad token
// even if many lookahead tokens were matched before failing to find
// a viable alt.
return ((NoViableAltException) e).getStartToken();
}
return offendingSymbol;
}
tlvParser.java 文件源码
项目:Oscar
阅读 23
收藏 0
点赞 0
评论 0
public final SnmpTypeContext snmpType() throws RecognitionException {
SnmpTypeContext _localctx = new SnmpTypeContext(_ctx, getState());
enterRule(_localctx, 22, RULE_snmpType);
try {
enterOuterAlt(_localctx, 1);
{
setState(87);
switch (_input.LA(1)) {
case 19:
{
{
setState(85); match(19);
}
}
break;
case 18:
{
{
setState(86); match(18);
}
}
break;
default:
throw new NoViableAltException(this);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
SoqlParser.java 文件源码
项目:components
阅读 27
收藏 0
点赞 0
评论 0
public final ObjectPrefixContext objectPrefix() throws RecognitionException {
ObjectPrefixContext _localctx = new ObjectPrefixContext(_ctx, getState());
enterRule(_localctx, 16, RULE_objectPrefix);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(73);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1: {
{
setState(71);
match(NAME);
setState(72);
match(DOT);
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(75);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input, 7, _ctx);
} while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
}
} catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
SoqlParser.java 文件源码
项目:components
阅读 21
收藏 0
点赞 0
评论 0
public final AnywordContext anyword() throws RecognitionException {
AnywordContext _localctx = new AnywordContext(_ctx, getState());
enterRule(_localctx, 22, RULE_anyword);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(86);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1: {
{
setState(85);
match(ANYCHAR);
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(88);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input, 8, _ctx);
} while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
}
} catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
QLParser.java 文件源码
项目:poly-ql
阅读 22
收藏 0
点赞 0
评论 0
public final BoolContext bool() throws RecognitionException {
BoolContext _localctx = new BoolContext(_ctx, getState());
enterRule(_localctx, 12, RULE_bool);
try {
setState(105);
switch (_input.LA(1)) {
case TRUE:
_localctx = new TrueContext(_localctx);
enterOuterAlt(_localctx, 1);
{
setState(103);
match(TRUE);
}
break;
case FALSE:
_localctx = new FalseContext(_localctx);
enterOuterAlt(_localctx, 2);
{
setState(104);
match(FALSE);
}
break;
default:
throw new NoViableAltException(this);
}
} catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
PSHDLLang.java 文件源码
项目:org.pshdl
阅读 25
收藏 0
点赞 0
评论 0
public final PsValueContext psValue() throws RecognitionException {
final PsValueContext _localctx = new PsValueContext(_ctx, getState());
enterRule(_localctx, 28, RULE_psValue);
try {
setState(403);
_errHandler.sync(this);
switch (_input.LA(1)) {
case RULE_PS_LITERAL_TERMINAL:
enterOuterAlt(_localctx, 1); {
setState(400);
match(RULE_PS_LITERAL_TERMINAL);
}
break;
case CLK:
case RST:
case RULE_ID:
enterOuterAlt(_localctx, 2); {
setState(401);
psVariableRef();
}
break;
case RULE_STRING:
enterOuterAlt(_localctx, 3); {
setState(402);
match(RULE_STRING);
}
break;
default:
throw new NoViableAltException(this);
}
} catch (final RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
PSHDLLang.java 文件源码
项目:org.pshdl
阅读 25
收藏 0
点赞 0
评论 0
public final PsFunctionDeclarationContext psFunctionDeclaration() throws RecognitionException {
final PsFunctionDeclarationContext _localctx = new PsFunctionDeclarationContext(_ctx, getState());
enterRule(_localctx, 48, RULE_psFunctionDeclaration);
try {
setState(478);
_errHandler.sync(this);
switch (_input.LA(1)) {
case SIMULATION:
case NATIVE:
enterOuterAlt(_localctx, 1); {
setState(475);
psNativeFunction();
}
break;
case INLINE:
enterOuterAlt(_localctx, 2); {
setState(476);
psInlineFunction();
}
break;
case SUBSTITUTE:
enterOuterAlt(_localctx, 3); {
setState(477);
psSubstituteFunction();
}
break;
default:
throw new NoViableAltException(this);
}
} catch (final RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
PSHDLLang.java 文件源码
项目:org.pshdl
阅读 26
收藏 0
点赞 0
评论 0
public final PsCompoundStatementContext psCompoundStatement() throws RecognitionException {
final PsCompoundStatementContext _localctx = new PsCompoundStatementContext(_ctx, getState());
enterRule(_localctx, 78, RULE_psCompoundStatement);
try {
setState(650);
_errHandler.sync(this);
switch (_input.LA(1)) {
case IF:
enterOuterAlt(_localctx, 1); {
setState(647);
psIfStatement();
}
break;
case FOR:
enterOuterAlt(_localctx, 2); {
setState(648);
psForStatement();
}
break;
case SWITCH:
enterOuterAlt(_localctx, 3); {
setState(649);
psSwitchStatement();
}
break;
default:
throw new NoViableAltException(this);
}
} catch (final RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
PSHDLLang.java 文件源码
项目:org.pshdl
阅读 21
收藏 0
点赞 0
评论 0
public final PsTypeDeclarationContext psTypeDeclaration() throws RecognitionException {
final PsTypeDeclarationContext _localctx = new PsTypeDeclarationContext(_ctx, getState());
enterRule(_localctx, 94, RULE_psTypeDeclaration);
try {
setState(733);
_errHandler.sync(this);
switch (_input.LA(1)) {
case INTERFACE:
enterOuterAlt(_localctx, 1); {
setState(731);
psInterfaceDeclaration();
}
break;
case ENUM:
enterOuterAlt(_localctx, 2); {
setState(732);
psEnumDeclaration();
}
break;
default:
throw new NoViableAltException(this);
}
} catch (final RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
PSHDLLang.java 文件源码
项目:org.pshdl
阅读 22
收藏 0
点赞 0
评论 0
public final PsArrayContext psArray() throws RecognitionException {
final PsArrayContext _localctx = new PsArrayContext(_ctx, getState());
enterRule(_localctx, 110, RULE_psArray);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(846);
_errHandler.sync(this);
_alt = 1;
do {
switch (_alt) {
case 1: {
{
setState(842);
match(BRACKET_OPEN);
setState(843);
psExpression(0);
setState(844);
match(BRACKET_CLOSE);
}
}
break;
default:
throw new NoViableAltException(this);
}
setState(848);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input, 105, _ctx);
} while ((_alt != 2) && (_alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER));
}
} catch (final RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
} finally {
exitRule();
}
return _localctx;
}
ParserATNSimulator.java 文件源码
项目:Scratch-ApuC
阅读 24
收藏 0
点赞 0
评论 0
@NotNull
protected NoViableAltException noViableAlt(@NotNull TokenStream input,
@NotNull ParserRuleContext outerContext,
@NotNull ATNConfigSet configs,
int startIndex)
{
return new NoViableAltException(parser, input,
input.get(startIndex),
input.LT(1),
configs, outerContext);
}
BeetlAntlrErrorStrategy.java 文件源码
项目:beetl2.0
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void reportError(Parser recognizer, RecognitionException e)
{
// if we've already reported an error and have not matched a token
// yet successfully, don't report any errors.
if (inErrorRecoveryMode(recognizer))
{
// System.err.print("[SPURIOUS] ");
return; // don't report spurious errors
}
beginErrorCondition(recognizer);
if (e instanceof NoViableAltException)
{
reportNoViableAlternative(recognizer, (NoViableAltException) e);
}
else if (e instanceof InputMismatchException)
{
reportInputMismatch(recognizer, (InputMismatchException) e);
}
else if (e instanceof FailedPredicateException)
{
reportFailedPredicate(recognizer, (FailedPredicateException) e);
}
else
{
// System.err.println("unknown recognition error type: " + e.getClass().getName());
BeetlException exception = new BeetlException(BeetlException.PARSER_UNKNOW_ERROR, e.getClass().getName(), e);
// exception.token = this.getGrammarToken(e.getOffendingToken());
exception.pushToken(this.getGrammarToken(e.getOffendingToken()));
throw exception;
}
}