parseText$Async method
Text =
$^,"\n\r
*
;
Implementation
AsyncResult<String> parseText$Async(State<ChunkedParsingSink> state) {
final $0 = AsyncResult<String>();
String? $2;
var $3 = 0;
late int $4;
void $1() {
while (true) {
switch ($3) {
case 0:
$4 = state.pos;
state.input.beginBuffering();
$3 = 1;
break;
case 1:
final $7 = state.input;
var $9 = false;
while (state.pos < $7.end) {
final $5 = $7.data.runeAt(state.pos - $7.start);
final $6 =
!($5 < 13 ? $5 == 10 : $5 <= 13 || $5 == 34 || $5 == 44);
if (!$6) {
$9 = true;
break;
}
state.pos += $5 > 0xffff ? 2 : 1;
}
if (!$9 && !$7.isClosed) {
$7.sleep = true;
$7.handle = $1;
$3 = 1;
return;
}
state.setOk(true);
state.input.endBuffering();
if (state.ok) {
final input = state.input;
final start = input.start;
$2 = input.data.substring($4 - start, state.pos - start);
}
$0.value = $2;
$0.isComplete = true;
state.input.handle = $0.onComplete;
$3 = -1;
return;
default:
throw StateError('Invalid state: ${$3}');
}
}
}
$1();
return $0;
}