本文整理了Java中org.antlr.v4.runtime.Parser.getErrorHandler()
方法的一些代码示例,展示了Parser.getErrorHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.getErrorHandler()
方法的具体详情如下:
包路径:org.antlr.v4.runtime.Parser
类名称:Parser
方法名:getErrorHandler
暂无
代码示例来源:origin: apache/incubator-shardingsphere
/**
* Get matched token by token type.
*
* @param tokenType token type
* @return matched token
* @throws RecognitionException mismatch throw exception
*/
public Token getMatchedToken(final int tokenType) throws RecognitionException {
Token result = parser.getCurrentToken();
boolean isIdentifierCompatible = false;
if (identifierTokenIndex == tokenType && identifierTokenIndex > result.getType()) {
isIdentifierCompatible = true;
}
if (result.getType() == tokenType || isIdentifierCompatible) {
if (Token.EOF != tokenType && isIdentifierCompatible && result instanceof CommonToken) {
((CommonToken) result).setType(identifierTokenIndex);
}
parser.getErrorHandler().reportMatch(parser);
parser.consume();
} else {
result = parser.getErrorHandler().recoverInline(parser);
if (parser.getBuildParseTree() && -1 == result.getTokenIndex()) {
parser.getContext().addErrorNode(parser.createErrorNode(parser.getContext(), result));
}
}
return result;
}
}
代码示例来源:origin: org.bitbucket.goalhub.krTools.krLanguages/swiprolog
String expectedtokens, RecognitionException e) {
ErrorStrategy4 strategy = (ErrorStrategy4) ((Parser) recognizer).getErrorHandler();
代码示例来源:origin: org.bitbucket.goalhub.grammar/languageTools
String expectedtokens, RecognitionException e) {
MyErrorStrategy strategy = (MyErrorStrategy) ((Parser) recognizer).getErrorHandler();
内容来源于网络,如有侵权,请联系作者删除!