本文整理了Java中org.antlr.v4.runtime.Parser.isExpectedToken()
方法的一些代码示例,展示了Parser.isExpectedToken()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.isExpectedToken()
方法的具体详情如下:
包路径:org.antlr.v4.runtime.Parser
类名称:Parser
方法名:isExpectedToken
[英]Checks whether or not symbol can follow the current state in the ATN. The behavior of this method is equivalent to the following, but is implemented such that the complete context-sensitive follow set does not need to be explicitly constructed.
return getExpectedTokens().contains(symbol);
[中]检查符号是否符合ATN中的当前状态。此方法的行为等同于以下内容,但实现时不需要显式构造完整的上下文相关跟随集
return getExpectedTokens().contains(symbol);
代码示例来源:origin: radkovo/jStyleParser
public void sync(Parser recognizer) throws RecognitionException {
ATNState s = recognizer.getInterpreter().atn.states.get(recognizer.getState());
if (!this.inErrorRecoveryMode(recognizer)) {
TokenStream tokens = recognizer.getInputStream();
int la = tokens.LA(1);
if (!recognizer.getATN().nextTokens(s).contains(la) && la != -1) {
if (!recognizer.isExpectedToken(la)) {
switch (s.getStateType()) {
case 3:
case 4:
case 5:
case 10:
throw new RecognitionException(recognizer, tokens, recognizer.getContext());
case 9:
case 11:
//added
this.reportUnwantedToken(recognizer);
throw new RecognitionException(recognizer, tokens, recognizer.getContext());
case 6:
case 7:
case 8:
default:
}
}
}
}
}
代码示例来源:origin: net.sf.cssbox/jstyleparser
public void sync(Parser recognizer) throws RecognitionException {
ATNState s = recognizer.getInterpreter().atn.states.get(recognizer.getState());
if (!this.inErrorRecoveryMode(recognizer)) {
TokenStream tokens = recognizer.getInputStream();
int la = tokens.LA(1);
if (!recognizer.getATN().nextTokens(s).contains(la) && la != -1) {
if (!recognizer.isExpectedToken(la)) {
switch (s.getStateType()) {
case 3:
case 4:
case 5:
case 10:
throw new RecognitionException(recognizer, tokens, recognizer.getContext());
case 9:
case 11:
//added
this.reportUnwantedToken(recognizer);
throw new RecognitionException(recognizer, tokens, recognizer.getContext());
case 6:
case 7:
case 8:
default:
}
}
}
}
}
代码示例来源:origin: cflint/CFLint
if (recognizer instanceof Parser && ((Parser) recognizer).isExpectedToken(CFSCRIPTParser.SEMICOLON)) {
final ContextMessage cm = new ContextMessage(MISSING_SEMI, expression, null, line, offset);
reportRule(currentElement, null, context, null, cm);
代码示例来源:origin: cflint/CFLint
if (recognizer instanceof Parser && ((Parser) recognizer).isExpectedToken(CFSCRIPTParser.SEMICOLON)) {
final ContextMessage cm = new ContextMessage(MISSING_SEMI, expression, null, line, offset);
reportRule(currentElement, null, context, null, cm);
代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime
if (recognizer.isExpectedToken(la)) {
return;
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
if (recognizer.isExpectedToken(la)) {
return;
内容来源于网络,如有侵权,请联系作者删除!