/** 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); }
/** 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 + '}'; } }
/** 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); }
/** 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); }
/** 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); }
/** 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); }
/** 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 + '}'; } }
/** 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 + '}'; } }
/** 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 + '}'; } }
/** 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 + '}'; } }
@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); } }
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()) ) {
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()),