stmtList method

Parser<StmtList> stmtList()

A complete stmt_list.

Implementation

Parser<StmtList> stmtList() => (ref0(stmt) &
            (ref1(token, ';') | ref0(whitespaceOrComments)).optional() &
            ref0(stmtList).optional())
        .optional()
        .map((result) {
      if (result == null) {
        return const StmtList([]);
      }

      final stmtList = <Statement>[result[0]];

      // Will just be empty if nothing was parsed - see the if-null block above.
      StmtList? more = result[2];
      if (more != null) {
        stmtList.addAll(more.statements);
      }

      return StmtList(stmtList);
    });