parseString method
String String = OpenQuote ↑ v:Chars CloseQuote {} ;
Implementation
String? parseString(State<String> state) {
String? $0;
// OpenQuote ↑ v:Chars CloseQuote {}
final $4 = state.pos;
var $2 = true;
final $3 = state.ignoreErrors;
// @inline OpenQuote = Spaces '"' ;
// Spaces '"'
final $5 = state.pos;
// Spaces
fastParseSpaces(state);
if (state.ok) {
const $6 = '"';
final $7 = state.pos < state.input.length &&
state.input.codeUnitAt(state.pos) == 34;
if ($7) {
state.pos++;
state.setOk(true);
} else {
state.fail(const ErrorExpectedTags([$6]));
}
}
if (!state.ok) {
state.backtrack($5);
}
if (state.ok) {
$2 = false;
state.ignoreErrors = false;
state.setOk(true);
if (state.ok) {
List<String>? $1;
// @inline Chars = ($[^"]+ / '""' <String>{})* ;
// ($[^"]+ / '""' <String>{})*
final $10 = <String>[];
final $9 = state.ignoreErrors;
state.ignoreErrors = true;
while (true) {
String? $11;
// $[^"]+
final $13 = state.pos;
var $14 = false;
for (var c = 0;
state.pos < state.input.length &&
(c = state.input.runeAt(state.pos)) == c &&
(c != 34);
state.pos += c > 0xffff ? 2 : 1,
// ignore: curly_braces_in_flow_control_structures, empty_statements
$14 = true);
if ($14) {
state.setOk($14);
} else {
state.pos < state.input.length
? state.fail(const ErrorUnexpectedCharacter())
: state.fail(const ErrorUnexpectedEndOfInput());
}
if (state.ok) {
$11 = state.input.substring($13, state.pos);
}
if (!state.ok && state.isRecoverable) {
// '""' <String>{}
const $16 = '""';
final $17 = state.pos + 1 < state.input.length &&
state.input.codeUnitAt(state.pos) == 34 &&
state.input.codeUnitAt(state.pos + 1) == 34;
if ($17) {
state.pos += 2;
state.setOk(true);
} else {
state.fail(const ErrorExpectedTags([$16]));
}
if (state.ok) {
String? $$;
$$ = '"';
$11 = $$;
}
}
if (!state.ok) {
break;
}
$10.add($11!);
}
state.ignoreErrors = $9;
state.setOk(true);
if (state.ok) {
$1 = $10;
}
if (state.ok) {
// @inline CloseQuote = '"' Spaces ;
// '"' Spaces
final $18 = state.pos;
const $19 = '"';
final $20 = state.pos < state.input.length &&
state.input.codeUnitAt(state.pos) == 34;
if ($20) {
state.pos++;
state.setOk(true);
} else {
state.fail(const ErrorExpectedTags([$19]));
}
if (state.ok) {
// Spaces
fastParseSpaces(state);
}
if (!state.ok) {
state.backtrack($18);
}
if (state.ok) {
String? $$;
final v = $1!;
$$ = v.join();
$0 = $$;
}
}
}
}
if (!state.ok) {
if (!$2) {
state.isRecoverable = false;
}
state.backtrack($4);
}
state.ignoreErrors = $3;
return $0;
}