parse method

  1. @override
Result<String>? parse(
  1. State<StringReader> state
)
override

Implementation

@override
Result<String>? parse(State<StringReader> state) {
  final input = state.input;
  final pos = state.pos;
  while (state.pos < input.length) {
    final c = input.readChar(state.pos);
    if (!(c >= 0x30 && c <= 0x39)) {
      break;
    }

    state.pos += input.count;
  }

  return state.pos != pos
      ? Result(input.substring(pos, state.pos))
      : const Result('');
}