isPrematureEndOfFile method

bool isPrematureEndOfFile()

Guard to break out of parser when an unexpected end of file is found.

Implementation

// TODO(jimhug): Failure to call this method can lead to inifinite parser
//   loops.  Consider embracing exceptions for more errors to reduce
//   the danger here.
bool isPrematureEndOfFile() {
  if (_maybeEat(TokenKind.END_OF_FILE)) {
    _error('unexpected end of file');
    return true;
  } else {
    return false;
  }
}