parse method

  1. @override
Tuple1<E>? parse(
  1. ParseState state
)
override

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<E>? parse(ParseState state) {
  final pos = state.pos;
  if (pos + 2 <= state.length) {
    final v1 = state.data.getUint16(pos, endian);
    if (m.match(v1)) {
      state.pos += 2;
      return _res;
    }
  }
}