本文整理了Java中org.antlr.v4.runtime.Parser.getRuleInvocationStack()
方法的一些代码示例,展示了Parser.getRuleInvocationStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.getRuleInvocationStack()
方法的具体详情如下:
包路径:org.antlr.v4.runtime.Parser
类名称:Parser
方法名:getRuleInvocationStack
[英]Return List<String> of the rule names in your parser instance leading up to a call to the current rule. You could override if you want more details such as the file/line info of where in the ATN a rule is invoked. This is very useful for error messages.
[中]返回解析器实例中规则名称的列表<String>,以调用当前规则。如果需要更多详细信息,例如ATN中调用规则的位置的文件/行信息,可以覆盖。这对于错误消息非常有用。
代码示例来源:origin: org.antlr/antlr4-runtime
/** Return List<String> of the rule names in your parser instance
* leading up to a call to the current rule. You could override if
* you want more details such as the file/line info of where
* in the ATN a rule is invoked.
*
* This is very useful for error messages.
*/
public List<String> getRuleInvocationStack() {
return getRuleInvocationStack(_ctx);
}
代码示例来源:origin: org.antlr/antlr4-runtime
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */
public String toInfoString(Parser recognizer) {
List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" +
"start=" + start +
", stop=" + stop +
'}';
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Return List<String> of the rule names in your parser instance
* leading up to a call to the current rule. You could override if
* you want more details such as the file/line info of where
* in the ATN a rule is invoked.
*
* This is very useful for error messages.
*/
public List<String> getRuleInvocationStack() {
return getRuleInvocationStack(_ctx);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Return List<String> of the rule names in your parser instance
* leading up to a call to the current rule. You could override if
* you want more details such as the file/line info of where
* in the ATN a rule is invoked.
*
* This is very useful for error messages.
*/
public List<String> getRuleInvocationStack() {
return getRuleInvocationStack(_ctx);
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4-runtime
/** Return List<String> of the rule names in your parser instance
* leading up to a call to the current rule. You could override if
* you want more details such as the file/line info of where
* in the ATN a rule is invoked.
*
* This is very useful for error messages.
*/
public List<String> getRuleInvocationStack() {
return getRuleInvocationStack(_ctx);
}
代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime
/** Return List<String> of the rule names in your parser instance
* leading up to a call to the current rule. You could override if
* you want more details such as the file/line info of where
* in the ATN a rule is invoked.
*
* This is very useful for error messages.
*/
public List<String> getRuleInvocationStack() {
return getRuleInvocationStack(_ctx);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */
public String toInfoString(Parser recognizer) {
List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" +
"start=" + start +
", stop=" + stop +
'}';
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */
public String toInfoString(Parser recognizer) {
List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" +
"start=" + start +
", stop=" + stop +
'}';
}
}
代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */
public String toInfoString(Parser recognizer) {
List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" +
"start=" + start +
", stop=" + stop +
'}';
}
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4-runtime
/** Used for rule context info debugging during parse-time, not so much for ATN debugging */
public String toInfoString(Parser recognizer) {
List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" +
"start=" + start +
", stop=" + stop +
'}';
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.scripting.sightly.compiler
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg,
RecognitionException e) {
String offendingInput;
if (Parser.class.isAssignableFrom(recognizer.getClass())) {
List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
Collections.reverse(stack);
offendingInput = ((CommonTokenStream) recognizer.getInputStream()).getTokenSource().getInputStream().toString();
} else {
offendingInput = recognizer.getInputStream().toString();
}
if (e != null) {
throw new SightlyCompilerException(msg, offendingInput, line, charPositionInLine, e);
}
throw new SightlyCompilerException(msg, offendingInput, line, charPositionInLine);
}
}
代码示例来源:origin: org.kie/kie-dmn-feel
final int tokenIndex = token.getTokenIndex();
final Parser parser = (Parser) recognizer;
if( parser.getRuleInvocationStack().contains( "nameDefinition" ) ) {
error = generateInvalidVariableError(offendingSymbol, line, charPositionInLine, e, token);
} else if ( "}".equals(token.getText()) && tokenIndex > 1 && ":".equals(parser.getTokenStream().get(tokenIndex - 1).getText()) ) {
代码示例来源:origin: org.kie/kie-dmn-feel
charPositionInLine,
offendingSymbol);
} else if( "}".equals( token.getText() ) && e != null && e.getRecognizer() instanceof Parser && ((Parser)e.getRecognizer()).getRuleInvocationStack().contains( "key" ) ) {
return new SyntaxErrorEvent(FEELEvent.Severity.ERROR,
Msg.createMessage(Msg.MISSING_EXPRESSION, e.getCtx().getText()),
内容来源于网络,如有侵权,请联系作者删除!