parseAsync method

Future<List<AstNode>> parseAsync(
  1. List<Token> tokens
)

Implementation

Future<List<AstNode>> parseAsync(List<Token> tokens) async {
  reset();
  this.tokens = tokens;
  List<Future<AstNode>> futures = [];

  while (!isAtEnd()) {
    futures.add(Future(() => declaration()));
    // Skip to the next top-level declaration
    synchronizeToNextDeclaration();
  }

  return await Future.wait(futures);
}