isPatternGuaranteedAtStep method

bool isPatternGuaranteedAtStep(
  1. int byteOffset
)

Whether reaching the query step at byteOffset guarantees that its root pattern will finish matching.

Implementation

bool isPatternGuaranteedAtStep(int byteOffset) {
  _checkNotDisposed();
  var low = 0;
  var high = guaranteedStepOffsets.length;
  while (low < high) {
    final middle = (low + high) >> 1;
    if (guaranteedStepOffsets[middle] <= byteOffset) {
      low = middle + 1;
    } else {
      high = middle;
    }
  }
  final index = low - 1;
  return index >= 0 && index < guaranteedStepValues.length
      ? guaranteedStepValues[index]
      : false;
}