parseRow$Async method
@event Row = @list1(Field, ',' ↑ v:Field) ;
Implementation
AsyncResult<List<String>> parseRow$Async(State<ChunkedParsingSink> state) {
final $0 = AsyncResult<List<String>>();
beginEvent(CsvParserEvent.rowEvent);
List<String>? $2;
var $3 = 0;
late bool $6;
late List<String> $7;
String? $4;
late AsyncResult<String> $8;
late AsyncResult<String> $10;
String? $5;
late bool $13;
late bool $14;
late int $15;
String? $12;
late AsyncResult<String> $20;
late AsyncResult<String> $22;
void $1() {
while (true) {
switch ($3) {
case 0:
$7 = [];
beginEvent(CsvParserEvent.fieldEvent);
state.input.beginBuffering();
$8 = parseString$Async(state);
if (!$8.isComplete) {
$8.onComplete = $1;
$3 = 1;
return;
}
$3 = 1;
break;
case 1:
$4 = $8.value;
state.input.endBuffering();
final $24 = !state.ok && state.isRecoverable;
if (!$24) {
$3 = 2;
break;
}
$10 = parseText$Async(state);
if (!$10.isComplete) {
$10.onComplete = $1;
$3 = 3;
return;
}
$3 = 3;
break;
case 2:
$4 = endEvent<String>(CsvParserEvent.fieldEvent, $4, state.ok);
final $25 = state.ok;
if (!$25) {
$3 = 4;
break;
}
$7.add($4!);
$6 = state.ignoreErrors;
state.ignoreErrors = true;
$3 = 6;
break;
case 3:
$4 = $10.value;
$3 = 2;
break;
case 4:
state.setOk($7.isNotEmpty);
if (state.ok) {
$2 = $7;
}
endEvent<List<String>>(CsvParserEvent.rowEvent, $2, state.ok);
$0.value = $2;
$0.isComplete = true;
state.input.handle = $0.onComplete;
$3 = -1;
return;
case 5:
state.ignoreErrors = $6;
$3 = 4;
break;
case 6:
$15 = state.pos;
$14 = true;
$13 = state.ignoreErrors;
$3 = 7;
break;
case 7:
final $16 = state.input;
if (state.pos >= $16.end && !$16.isClosed) {
$16.sleep = true;
$16.handle = $1;
$3 = 7;
return;
}
const $17 = ',';
final $18 = state.pos < $16.end &&
$16.data.codeUnitAt(state.pos - $16.start) == 44;
if ($18) {
state.pos++;
state.setOk(true);
} else {
state.fail(const ErrorExpectedTags([$17]));
}
final $27 = state.ok;
if (!$27) {
$3 = 8;
break;
}
$14 = false;
state.ignoreErrors = false;
state.setOk(true);
state.input.cut(state.pos);
final $28 = state.ok;
if (!$28) {
$3 = 9;
break;
}
beginEvent(CsvParserEvent.fieldEvent);
state.input.beginBuffering();
$20 = parseString$Async(state);
if (!$20.isComplete) {
$20.onComplete = $1;
$3 = 10;
return;
}
$3 = 10;
break;
case 8:
if (!state.ok) {
if (!$14) {
state.isRecoverable = false;
}
state.backtrack($15);
}
state.ignoreErrors = $13;
if (!state.ok) {
$3 = 5;
break;
}
$7.add($5!);
$3 = 6;
break;
case 9:
$3 = 8;
break;
case 10:
$12 = $20.value;
state.input.endBuffering();
final $29 = !state.ok && state.isRecoverable;
if (!$29) {
$3 = 11;
break;
}
$22 = parseText$Async(state);
if (!$22.isComplete) {
$22.onComplete = $1;
$3 = 12;
return;
}
$3 = 12;
break;
case 11:
$12 = endEvent<String>(CsvParserEvent.fieldEvent, $12, state.ok);
if (state.ok) {
$5 = $12;
}
$3 = 9;
break;
case 12:
$12 = $22.value;
$3 = 11;
break;
default:
throw StateError('Invalid state: ${$3}');
}
}
}
$1();
return $0;
}