parseRow method

List<String>? parseRow(
  1. State<String> state
)

@event Row = @list1(Field, Separator ↑ v:Field) ;

Implementation

List<String>? parseRow(State<String> state) {
  beginEvent(CsvExParserEvent.rowEvent);
  List<String>? $0;
  // @list1(Field, Separator ↑ v:Field)
  final $2 = <String>[];
  String? $3;
  // Field
  beginEvent(CsvExParserEvent.fieldEvent);
  // @event @inline Field = String / Text ;
  // String
  // String
  $3 = parseString(state);
  if (!state.ok && state.isRecoverable) {
    // Text
    // Text
    $3 = parseText(state);
  }
  $3 = endEvent<String>(CsvExParserEvent.fieldEvent, $3, state.ok);
  if (state.ok) {
    $2.add($3!);
    final $5 = state.ignoreErrors;
    state.ignoreErrors = true;
    while (true) {
      String? $4;
      // Separator ↑ v:Field
      final $13 = state.pos;
      var $11 = true;
      final $12 = state.ignoreErrors;
      // @inline Separator = @matchString() ;
      // @matchString()
      final $15 = _separator;
      if ($15.isEmpty) {
        state.setOk(true);
      } else {
        final ok = state.pos < state.input.length &&
            state.input.codeUnitAt(state.pos) == $15.codeUnitAt(0) &&
            state.input.startsWith($15, state.pos);
        if (ok) {
          state.pos += $15.length;
          state.setOk(true);
        } else {
          state.fail(ErrorExpectedTags([$15]));
        }
      }
      if (state.ok) {
        $11 = false;
        state.ignoreErrors = false;
        state.setOk(true);
        if (state.ok) {
          String? $10;
          beginEvent(CsvExParserEvent.fieldEvent);
          // @event @inline Field = String / Text ;
          // String
          // String
          $10 = parseString(state);
          if (!state.ok && state.isRecoverable) {
            // Text
            // Text
            $10 = parseText(state);
          }
          $10 = endEvent<String>(CsvExParserEvent.fieldEvent, $10, state.ok);
          if (state.ok) {
            $4 = $10;
          }
        }
      }
      if (!state.ok) {
        if (!$11) {
          state.isRecoverable = false;
        }
        state.backtrack($13);
      }
      state.ignoreErrors = $12;
      if (!state.ok) {
        break;
      }
      $2.add($4!);
    }
    state.ignoreErrors = $5;
  }
  state.setOk($2.isNotEmpty);
  if (state.ok) {
    $0 = $2;
  }
  $0 = endEvent<List<String>>(CsvExParserEvent.rowEvent, $0, state.ok);
  return $0;
}