parseAsync method

  1. @override
void parseAsync(
  1. State<ChunkedData<I>> state,
  2. ResultCallback<O2> onDone
)
override

Implementation

@override
void parseAsync(State<ChunkedData<I>> state, ResultCallback<O2> onDone) {
  final input = state.input;
  final pos = state.pos;
  Result<O2>? r;
  void parse3() {
    end.parseAsync(state, (result) {
      if (result == null) {
        state.pos = pos;
        onDone(null);
      } else {
        onDone(r);
      }
    });
  }

  void parse2() {
    p.parseAsync(state, (result) {
      if (result == null) {
        state.pos = pos;
        onDone(null);
      } else {
        r = result;
        input.handle(parse3);
      }
    });
  }

  void parse() {
    start.parseAsync(state, (result) {
      if (result == null) {
        onDone(null);
      } else {
        input.handle(parse2);
      }
    });
  }

  parse();
}