parseProgram method

Program parseProgram()

Implementation

Program parseProgram() {
  int start = token?.startOffset??0;
  int line = token?.line??0;
  List<Statement> statements = <Statement>[];
  while (token?.type != Token.EOF) {
    statements.add(parseStatement());
  }
  if (endOffset == null) {
    endOffset = start;
  }
  int endLine = lexer!.getLineCount(start, endOffset) + line - 1;
  return new Program(statements)
    ..start = start
    ..end = endOffset
    ..line = line
    ..endLine = endLine;
}