recognize

abstract fun recognize(s: String, startAt: Int): Pair<String, Int>?

Check whether the string s starting from index startAt matches the pattern this recognizer uses.

  • If successful, return a pair with the matched pattern and the first index that is outside of the matched pattern.

  • If unsuccessful, return null