parse method
Implementation
@override
Result<String>? parse(State<StringReader> state) {
final input = state.input;
final list = <String>[];
var str = '';
while (state.pos < input.length) {
final pos = state.pos;
str = '';
var c = -1;
while (state.pos < input.length) {
c = input.readChar(state.pos);
final ok = isNormalChar(c);
if (!ok) {
break;
}
state.pos += input.count;
}
if (state.pos != pos) {
str = input.substring(pos, state.pos);
if (list.isNotEmpty) {
list.add(str);
}
}
if (c != controlChar) {
break;
}
state.pos += 1;
final r = escapeChar.parse(state);
if (r == null) {
state.pos = pos;
break;
}
if (list.isEmpty && str != '') {
list.add(str);
}
list.add(r.value);
}
if (list.isEmpty) {
return Result(str);
}
return Result(list.join());
}