parseAsync method

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

Implementation

@override
void parseAsync(
    State<ChunkedData<I>> state, ResultCallback<List<O1>> onDone) {
  final input = state.input;
  final list = <O1>[];
  void parse2() {
    void parse3() {
      p.parseAsync(state, (result) {
        if (result == null) {
          onDone(null);
        } else {
          list.add(result.value);
          input.handle(parse2);
        }
      });
    }

    sep.parseAsync(state, (result) {
      if (result == null) {
        onDone(Result(list));
      } else {
        input.handle(parse3);
      }
    });
  }

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

  parse();
}