parseStart$Async method
@event Start = v:Rows Eol? @eof() ;
Implementation
AsyncResult<List<List<String>>> parseStart$Async(
State<ChunkedParsingSink> state) {
final $0 = AsyncResult<List<List<String>>>();
beginEvent(CsvParserEvent.startEvent);
List<List<String>>? $2;
var $3 = 0;
late int $5;
List<List<String>>? $4;
late AsyncResult<List<List<String>>> $6;
late bool $8;
late AsyncResult<Object?> $9;
void $1() {
while (true) {
switch ($3) {
case 0:
$5 = state.pos;
$6 = parseRows$Async(state);
if (!$6.isComplete) {
$6.onComplete = $1;
$3 = 1;
return;
}
$3 = 1;
break;
case 1:
$4 = $6.value;
final $13 = state.ok;
if (!$13) {
$3 = 2;
break;
}
$8 = state.ignoreErrors;
state.ignoreErrors = true;
$9 = fastParseEol$Async(state);
if (!$9.isComplete) {
$9.onComplete = $1;
$3 = 3;
return;
}
$3 = 3;
break;
case 2:
if (!state.ok) {
state.backtrack($5);
}
endEvent<List<List<String>>>(
CsvParserEvent.startEvent, $2, state.ok);
$0.value = $2;
$0.isComplete = true;
state.input.handle = $0.onComplete;
$3 = -1;
return;
case 3:
state.ignoreErrors = $8;
if (!state.ok) {
state.setOk(true);
}
final $14 = state.ok;
if (!$14) {
$3 = 4;
break;
}
$3 = 5;
break;
case 4:
$3 = 2;
break;
case 5:
final $11 = state.input;
if (state.pos >= $11.end && !$11.isClosed) {
$11.sleep = true;
$11.handle = $1;
$3 = 5;
return;
}
if (state.pos >= $11.end) {
state.setOk(true);
} else {
state.fail(const ErrorExpectedEndOfInput());
}
if (state.ok) {
$2 = $4;
}
$3 = 4;
break;
default:
throw StateError('Invalid state: ${$3}');
}
}
}
$1();
return $0;
}