/** * ==== IMPORTANT ==== * This should never again be public because it does not honour the * chunks defined by actions+collect mode. It only honours chunks of * actions. This should not be made visible to the outside. * * <p>calls {@link #next} once and applies the returned {@link * FaAction}. This includes the special actions configured for non * matching input and EOF, if any.</p> * * <p>Due to the <code>FaAction<code> applied to <code>out</code> * after calling <code>next</code> anything can happen to * <code>out</code>. In particular it need not become longer.</p> * * @return <code>false</code> if <code>out</code> was not changed * and would not be changed — due to EOF — by any * subsequent calls to this method. If <code>true</code> is * returned, <code>out</code> is not necessarily changed, but there * is more input available to process. */ private boolean crunch(StringBuilder out) throws java.io.IOException { int l = out.length(); action = next(out); if (action == null) return true; if (action == EOF) { // there may have been some unmatched characters added to out // just before EOF was hit return l < out.length(); } try { action.invoke(out, matchStart, this); } catch (CallbackException e) { String msg; if (matchStart <= out.length()) { msg = e.getMessage() + ". The match, possibly changed by the complaining " + "action, follows in " + "double brackets:\n[[" + out.substring(matchStart) + "]]"; } else { msg = e.getMessage() + ". Matched and filtered data just before the " + "match triggering the exception is: `" + out + "'"; } CallbackException ee = new CallbackException(msg); ee.setStackTrace(e.getStackTrace()); ee.initCause(e.getCause()); throw ee; } return true; }
public void invoke(StringBuffer out, int start, DfaRun r) throws CallbackException { r.setDfa(dfa); if (action != null) action.invoke(out, start, r); }