skipPattern method

Match? skipPattern(
  1. Pattern p
)

Match p at the text directly after the cursor and skip over the match if it exists, else return null.

You might also be interested in:

Implementation

Match? skipPattern(Pattern p) {
  Match? match = p.matchAsPrefix(buffer.substring(index));

  if (match != null) {
    history.add(index);
    // The end of the match is the same as its length since it was matched as a prefix.
    index += match.end;
  }

  return match;
}