@Override
  public <V> boolean match(final MatcherContext<V> context) {
    final boolean condition =
        inner == null ? context.getMatcher().match(context) : inner.match(context);
    if (!condition) return false;
    if (errorIndex < context.getCurrentIndex() && notTestNot(context))
      errorIndex = context.getCurrentIndex();

    return true;
  }
Example #2
0
  @Override
  public <V> boolean match(final MatcherContext<V> context) {
    if (!context.fastStringMatching()) return super.match(context);

    if (!context.getInputBuffer().test(context.getCurrentIndex(), characters)) return false;
    context.advanceIndex(characters.length);
    context.createNode();
    return true;
  }
 @Override
 public <V> boolean match(final MatcherContext<V> context) {
   final InputBuffer buffer = context.getInputBuffer();
   final boolean success = buffer.test(context.getCurrentIndex(), chars);
   if (success) {
     context.advanceIndex(2);
     context.createNode();
   }
   return success;
 }
  public boolean match(MatcherContext context) {
    int lastIndex = context.getCurrentIndex();
    Object valueStackSnapshot = context.getValueStack().takeSnapshot();

    if (!subMatcher.getSubContext(context).runMatcher()) return false;

    // reset location, Test matchers never advance
    context.setCurrentIndex(lastIndex);

    // erase all value stack changes the the submatcher could have made
    context.getValueStack().restoreSnapshot(valueStackSnapshot);
    return true;
  }