declaration method

Stmt? declaration({
  1. bool rethrowError = true,
})

Implementation

Stmt? declaration({bool rethrowError = true}) {
  try {
    if (match([TokenType.CLASS])) return classDeclaration();
    if (match([TokenType.FUN])) return function("function");
    if (match([TokenType.VAR])) return varDeclaration();
    return statement();
  } on ParseError {
    synchronize();
    if (rethrowError) {
      rethrow;
    } else {
      return null;
    }
  }
}