/** * This is called by {@link #reportError} when the exception is a * {@link FailedPredicateException}. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception */ protected void reportFailedPredicate(Parser recognizer, FailedPredicateException e) { String ruleName = recognizer.getRuleNames()[recognizer._ctx.getRuleIndex()]; String msg = "rule "+ruleName+" "+e.getMessage(); recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e); }
public static String failedPredicate(FailedPredicateException e) { String ruleName = e.getRecognizer().getRuleNames()[e.getRuleIndex()]; return "rule<" + ruleName + ">:" + e.getMessage(); }
/** * This is called by {@link #reportError} when the exception is a * {@link FailedPredicateException}. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception */ protected void reportFailedPredicate(Parser recognizer, FailedPredicateException e) { String ruleName = recognizer.getRuleNames()[recognizer._ctx.getRuleIndex()]; String msg = "rule "+ruleName+" "+e.getMessage(); recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e); }
/** * This is called by {@link #reportError} when the exception is a * {@link FailedPredicateException}. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception */ protected void reportFailedPredicate(Parser recognizer, FailedPredicateException e) { String ruleName = recognizer.getRuleNames()[recognizer._ctx.getRuleIndex()]; String msg = "rule "+ruleName+" "+e.getMessage(); recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e); }
/** * This is called by {@link #reportError} when the exception is a * {@link FailedPredicateException}. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception */ protected void reportFailedPredicate(Parser recognizer, FailedPredicateException e) { String ruleName = recognizer.getRuleNames()[recognizer._ctx.getRuleIndex()]; String msg = "rule "+ruleName+" "+e.getMessage(); recognizer.notifyErrorListeners(e.getOffendingToken(), msg, e); }
/** * This is called by {@link #reportError} when the exception is a * {@link FailedPredicateException}. * * @see #reportError * * @param recognizer the parser instance * @param e the recognition exception */ protected void reportFailedPredicate(@NotNull Parser recognizer, @NotNull FailedPredicateException e) { String ruleName = recognizer.getRuleNames()[recognizer._ctx.getRuleIndex()]; String msg = "rule "+ruleName+" "+e.getMessage(); notifyErrorListeners(recognizer, msg, e); }
@Override public void reportFailedPredicate(Parser parser, FailedPredicateException e) { setErrorState(parser); DiagnosticPos pos = getPosition(getMissingSymbol(parser)); if (parser.getContext() instanceof BallerinaParser.ShiftExprPredicateContext) { dlog.error(pos, DiagnosticCode.INVALID_SHIFT_OPERATOR); } else if (parser.getContext() instanceof BallerinaParser.RestDescriptorPredicateContext) { dlog.error(pos, DiagnosticCode.INVALID_RECORD_REST_DESCRIPTOR); } else { dlog.error(pos, DiagnosticCode.FAILED_PREDICATE, e.getMessage()); } }