use of org.beetl.core.exception.BeetlParserException in project beetl2.0 by javamonkey.
the class BeetlAntlrErrorStrategy method reportMissingToken.
protected void reportMissingToken(@NotNull Parser recognizer) {
if (inErrorRecoveryMode(recognizer)) {
return;
}
beginErrorCondition(recognizer);
// Token t = recognizer.getCurrentToken();
Token t = recognizer.getTokenStream().LT(-1);
IntervalSet expecting = getExpectedTokens(recognizer);
String expect = expecting.toString(recognizer.getTokenNames());
if (expects.containsKey(expect)) {
expect = expects.get(expect);
}
if (expect.equals("'>>'")) {
expect = "'模板的占位结束符号'";
}
String tokenStr = getTokenErrorDisplay(t);
String msg = "缺少输入 " + expect + " 在 " + tokenStr + " 后面";
BeetlException exception = new BeetlParserException(BeetlException.PARSER_MISS_ERROR, msg);
exception.pushToken(this.getGrammarToken(t));
throw exception;
}
Aggregations