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 bool $19;
  late bool $20;
  late int $28;
  late AsyncResult<Object?> $33;
  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 $35 = state.ok;
          if (!$35) {
            $3 = 2;
            break;
          }
          $3 = 3;
          break;
        case 2:
          if (!state.ok) {
            state.backtrack($8);
          }
          final $36 = state.ok;
          if (!$36) {
            $3 = 4;
            break;
          }
          $6 = false;
          state.ignoreErrors = false;
          state.setOk(true);
          state.input.cut(state.pos);
          final $37 = state.ok;
          if (!$37) {
            $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 = 13;
            break;
          }
          $28 = state.pos;
          $3 = 14;
          break;
        case 7:
          $18 = state.pos;
          state.input.beginBuffering();
          $20 = false;
          $19 = state.ignoreErrors;
          $3 = 9;
          break;
        case 8:
          state.ignoreErrors = $19;
          state.setOk($20);
          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 = 11;
            break;
          }
          $3 = 12;
          break;
        case 9:
          state.ignoreErrors = $20;
          $3 = 10;
          break;
        case 10:
          final $21 = state.input;
          if (state.pos >= $21.end && !$21.isClosed) {
            $21.sleep = true;
            $21.handle = $1;
            $3 = 10;
            return;
          }
          if (state.pos < $21.end) {
            final c = $21.data.runeAt(state.pos - $21.start);
            final $22 = c != 34;
            if ($22) {
              state.pos += c > 0xffff ? 2 : 1;
              state.setOk(true);
            } else {
              state.fail(const ErrorUnexpectedCharacter());
            }
          } else {
            state.fail(const ErrorUnexpectedEndOfInput());
          }
          if (!state.ok) {
            $3 = 8;
            break;
          }
          $20 = true;
          $3 = 9;
          break;
        case 11:
          if (!state.ok) {
            $3 = 6;
            break;
          }
          $17.add($15!);
          $3 = 7;
          break;
        case 12:
          final $24 = state.input;
          if (state.pos + 1 >= $24.end && !$24.isClosed) {
            $24.sleep = true;
            $24.handle = $1;
            $3 = 12;
            return;
          }
          const $25 = '""';
          final $26 = state.pos + 1 < $24.end &&
              $24.data.codeUnitAt(state.pos - $24.start) == 34 &&
              $24.data.codeUnitAt(state.pos - $24.start + 1) == 34;
          if ($26) {
            state.pos += 2;
            state.setOk(true);
          } else {
            state.fail(const ErrorExpectedTags([$25]));
          }
          if (state.ok) {
            String? $$;
            $$ = '"';
            $15 = $$;
          }
          $3 = 11;
          break;
        case 13:
          $3 = 5;
          break;
        case 14:
          final $29 = state.input;
          if (state.pos >= $29.end && !$29.isClosed) {
            $29.sleep = true;
            $29.handle = $1;
            $3 = 14;
            return;
          }
          const $30 = '"';
          final $31 = state.pos < $29.end &&
              $29.data.codeUnitAt(state.pos - $29.start) == 34;
          if ($31) {
            state.pos++;
            state.setOk(true);
          } else {
            state.fail(const ErrorExpectedTags([$30]));
          }
          final $42 = state.ok;
          if (!$42) {
            $3 = 15;
            break;
          }
          $33 = fastParseSpaces$Async(state);
          if (!$33.isComplete) {
            $33.onComplete = $1;
            $3 = 16;
            return;
          }
          $3 = 16;
          break;
        case 15:
          if (!state.ok) {
            state.backtrack($28);
          }
          if (state.ok) {
            String? $$;
            final v = $4!;
            $$ = v.join();
            $2 = $$;
          }
          $3 = 13;
          break;
        case 16:
          $3 = 15;
          break;
        default:
          throw StateError('Invalid state: ${$3}');
      }
    }
  }

  $1();
  return $0;
}