parseString$Async method

AsyncResult<String> parseString$Async(
  1. State<ChunkedParsingSink> state
)

String String = OpenQuote ↑ v:Chars CloseQuote {} ;

Implementation

AsyncResult<String> parseString$Async(State<ChunkedParsingSink> state) {
  final $0 = AsyncResult<String>();
  String? $2;
  var $3 = 0;
  late bool $5;
  late bool $6;
  late int $7;
  late int $8;
  late AsyncResult<Object?> $9;
  List<String>? $4;
  late bool $16;
  late List<String> $17;
  String? $15;
  late int $18;
  late int $23;
  late int $29;
  late AsyncResult<Object?> $34;
  void $1() {
    while (true) {
      switch ($3) {
        case 0:
          $7 = state.pos;
          $6 = true;
          $5 = state.ignoreErrors;
          $8 = state.pos;
          $9 = fastParseSpaces$Async(state);
          if (!$9.isComplete) {
            $9.onComplete = $1;
            $3 = 1;
            return;
          }
          $3 = 1;
          break;
        case 1:
          final $36 = state.ok;
          if (!$36) {
            $3 = 2;
            break;
          }
          $3 = 3;
          break;
        case 2:
          if (!state.ok) {
            state.backtrack($8);
          }
          final $37 = state.ok;
          if (!$37) {
            $3 = 4;
            break;
          }
          $6 = false;
          state.ignoreErrors = false;
          state.setOk(true);
          state.input.cut(state.pos);
          final $38 = state.ok;
          if (!$38) {
            $3 = 5;
            break;
          }
          $17 = <String>[];
          $16 = state.ignoreErrors;
          state.ignoreErrors = true;
          $3 = 7;
          break;
        case 3:
          final $11 = state.input;
          if (state.pos >= $11.end && !$11.isClosed) {
            $11.sleep = true;
            $11.handle = $1;
            $3 = 3;
            return;
          }
          const $12 = '"';
          final $13 = state.pos < $11.end &&
              $11.data.codeUnitAt(state.pos - $11.start) == 34;
          if ($13) {
            state.pos++;
            state.setOk(true);
          } else {
            state.fail(const ErrorExpectedTags([$12]));
          }
          $3 = 2;
          break;
        case 4:
          if (!state.ok) {
            if (!$6) {
              state.isRecoverable = false;
            }
            state.backtrack($7);
          }
          state.ignoreErrors = $5;
          $0.value = $2;
          $0.isComplete = true;
          state.input.handle = $0.onComplete;
          $3 = -1;
          return;
        case 5:
          $3 = 4;
          break;
        case 6:
          state.ignoreErrors = $16;
          state.setOk(true);
          if (state.ok) {
            $4 = $17;
          }
          final $41 = state.ok;
          if (!$41) {
            $3 = 11;
            break;
          }
          $29 = state.pos;
          $3 = 12;
          break;
        case 7:
          $18 = state.pos;
          state.input.beginBuffering();
          $23 = 0;
          $3 = 8;
          break;
        case 8:
          final $21 = state.input;
          var $24 = false;
          while (state.pos < $21.end) {
            final $19 = $21.data.runeAt(state.pos - $21.start);
            final $20 = $19 != 34;
            if (!$20) {
              $24 = true;
              break;
            }
            state.pos += $19 > 0xffff ? 2 : 1;
            $23++;
          }
          if (!$24 && !$21.isClosed) {
            $21.sleep = true;
            $21.handle = $1;
            $3 = 8;
            return;
          }
          if ($23 != 0) {
            state.setOk(true);
          } else {
            $21.isClosed
                ? state.fail(const ErrorUnexpectedEndOfInput())
                : state.fail(const ErrorUnexpectedCharacter());
          }
          state.input.endBuffering();
          if (state.ok) {
            final input = state.input;
            final start = input.start;
            $15 = input.data.substring($18 - start, state.pos - start);
          }
          final $40 = !state.ok && state.isRecoverable;
          if (!$40) {
            $3 = 9;
            break;
          }
          $3 = 10;
          break;
        case 9:
          if (!state.ok) {
            $3 = 6;
            break;
          }
          $17.add($15!);
          $3 = 7;
          break;
        case 10:
          final $25 = state.input;
          if (state.pos + 1 >= $25.end && !$25.isClosed) {
            $25.sleep = true;
            $25.handle = $1;
            $3 = 10;
            return;
          }
          const $26 = '""';
          final $27 = state.pos + 1 < $25.end &&
              $25.data.codeUnitAt(state.pos - $25.start) == 34 &&
              $25.data.codeUnitAt(state.pos - $25.start + 1) == 34;
          if ($27) {
            state.pos += 2;
            state.setOk(true);
          } else {
            state.fail(const ErrorExpectedTags([$26]));
          }
          if (state.ok) {
            String? $$;
            $$ = '"';
            $15 = $$;
          }
          $3 = 9;
          break;
        case 11:
          $3 = 5;
          break;
        case 12:
          final $30 = state.input;
          if (state.pos >= $30.end && !$30.isClosed) {
            $30.sleep = true;
            $30.handle = $1;
            $3 = 12;
            return;
          }
          const $31 = '"';
          final $32 = state.pos < $30.end &&
              $30.data.codeUnitAt(state.pos - $30.start) == 34;
          if ($32) {
            state.pos++;
            state.setOk(true);
          } else {
            state.fail(const ErrorExpectedTags([$31]));
          }
          final $42 = state.ok;
          if (!$42) {
            $3 = 13;
            break;
          }
          $34 = fastParseSpaces$Async(state);
          if (!$34.isComplete) {
            $34.onComplete = $1;
            $3 = 14;
            return;
          }
          $3 = 14;
          break;
        case 13:
          if (!state.ok) {
            state.backtrack($29);
          }
          if (state.ok) {
            String? $$;
            final v = $4!;
            $$ = v.join();
            $2 = $$;
          }
          $3 = 11;
          break;
        case 14:
          $3 = 13;
          break;
        default:
          throw StateError('Invalid state: ${$3}');
      }
    }
  }

  $1();
  return $0;
}