parse method
Parses input data actively and produces the result.
Returns Tuple1 of the result if parsing was successful; otherwise
returns null
.
final r1 = p.parse(state);
Implementation
@override
Tuple1<String>? parse(ParseState state) {
final pos = state.pos;
final data = state.data;
if (pos + _length <= state.length) {
final c = data.getUint16(pos, Endian.little);
if (c == _c) {
var ok = true;
var newPos = pos + 2;
for (var i = 1; i < s.length; i++) {
final c = data.getUint16(newPos, Endian.little);
if (c != s.codeUnitAt(i)) {
ok = false;
break;
}
newPos += 2;
}
if (ok) {
state.pos = newPos;
return _res;
}
}
}
state.pos = pos;
}