Interface LookaheadMatcher

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface LookaheadMatcher

    Look-ahead matcher callback for Parser.skipPeek(LookaheadMatcher).

    This is a functional interface for method references or lambdas. It contains one method toSkip(int, int) that determines whether to abort or continue skipping, based on the characters in the input data.

    This interface is identical to BiFunction<int, int, boolean> except for the name of its functional method.

    Author:
    mirabilos (t.glaser@tarent.de)
    See Also:
    ContextlessMatcher, BiFunction
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean toSkip​(int cur, int next)
      Determines whether the current character is to be skipped.
    • Method Detail

      • toSkip

        boolean toSkip​(int cur,
                       int next)

        Determines whether the current character is to be skipped.

        Skipping ahead is determined based on the codepoints in the file, that is, the input fully decoded to UCS (ISO 10646) codepoints, not just bytes or Java™-internal UTF-16 characters. If the end of input is reached, -1 will be passed; otherwise, the 21-bit UCS codepoint of the respective wide (possibly multibyte, in the input) character.

        Parameters:
        cur - the codepoint of the current character
        next - the codepoint of the character past the current one
        Returns:
        true to continue skipping ahead, false to stop skipping