fastParseSpaces$Async method

AsyncResult<Object?> fastParseSpaces$Async(
  1. State<ChunkedParsingSink> state
)

Spaces = \t* ;

Implementation

AsyncResult<Object?> fastParseSpaces$Async(State<ChunkedParsingSink> state) {
  final $0 = AsyncResult<Object?>();
  var $2 = 0;
  late bool $3;
  void $1() {
    while (true) {
      switch ($2) {
        case 0:
          $3 = state.ignoreErrors;
          state.ignoreErrors = true;
          $2 = 2;
          break;
        case 1:
          state.ignoreErrors = $3;
          state.setOk(true);
          $0.isComplete = true;
          state.input.handle = $0.onComplete;
          $2 = -1;
          return;
        case 2:
          final $4 = state.input;
          if (state.pos >= $4.end && !$4.isClosed) {
            $4.sleep = true;
            $4.handle = $1;
            $2 = 2;
            return;
          }
          if (state.pos < $4.end) {
            final c = $4.data.codeUnitAt(state.pos - $4.start);
            final $5 = c == 9 || c == 32;
            if ($5) {
              state.pos++;
              state.setOk(true);
            } else {
              state.fail(const ErrorUnexpectedCharacter());
            }
          } else {
            state.fail(const ErrorUnexpectedEndOfInput());
          }
          if (!state.ok) {
            $2 = 1;
            break;
          }
          $2 = 2;
          break;
        default:
          throw StateError('Invalid state: ${$2}');
      }
    }
  }

  $1();
  return $0;
}