// Generated by Lisette bindgen
// Source: go/parser (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.14

import "go:go/ast"
import "go:go/token"
import "go:io/fs"

/// ParseDir calls [ParseFile] for all files with names ending in ".go" in the
/// directory specified by path and returns a map of package name -> package
/// AST with all the packages found.
/// 
/// If filter != nil, only the files with [fs.FileInfo] entries passing through
/// the filter (and ending in ".go") are considered. The mode bits are passed
/// to [ParseFile] unchanged. Position information is recorded in fset, which
/// must not be nil.
/// 
/// If the directory couldn't be read, a nil map and the respective error are
/// returned. If a parse error occurred, a non-nil but incomplete map and the
/// first error encountered are returned.
/// 
/// Deprecated: ParseDir does not consider build tags when associating
/// files with packages. For precise information about the relationship
/// between packages and files, use golang.org/x/tools/go/packages,
/// which can also optionally parse and type-check the files too.
pub fn ParseDir(
  fset: Ref<token.FileSet>,
  path: string,
  filter: fn(fs.FileInfo) -> bool,
  mode: Mode,
) -> Result<Map<string, Ref<ast.Package>>, error>

/// ParseExpr is a convenience function for obtaining the AST of an expression x.
/// The position information recorded in the AST is undefined. The filename used
/// in error messages is the empty string.
/// 
/// If syntax errors were found, the result is a partial AST (with [ast.Bad]* nodes
/// representing the fragments of erroneous source code). Multiple errors are
/// returned via a scanner.ErrorList which is sorted by source position.
pub fn ParseExpr(x: string) -> Result<ast.Expr, error>

/// ParseExprFrom is a convenience function for parsing an expression.
/// The arguments have the same meaning as for [ParseFile], but the source must
/// be a valid Go (type or value) expression. Specifically, fset must not
/// be nil.
/// 
/// If the source couldn't be read, the returned AST is nil and the error
/// indicates the specific failure. If the source was read but syntax
/// errors were found, the result is a partial AST (with [ast.Bad]* nodes
/// representing the fragments of erroneous source code). Multiple errors
/// are returned via a scanner.ErrorList which is sorted by source position.
pub fn ParseExprFrom(
  fset: Ref<token.FileSet>,
  filename: string,
  src: Unknown,
  mode: Mode,
) -> Result<ast.Expr, error>

/// ParseFile parses the source code of a single Go source file and returns
/// the corresponding [ast.File] node. The source code may be provided via
/// the filename of the source file, or via the src parameter.
/// 
/// If src != nil, ParseFile parses the source from src and the filename is
/// only used when recording position information. The type of the argument
/// for the src parameter must be string, []byte, or [io.Reader].
/// If src == nil, ParseFile parses the file specified by filename.
/// 
/// The mode parameter controls the amount of source text parsed and
/// other optional parser functionality. If the [SkipObjectResolution]
/// mode bit is set (recommended), the object resolution phase of
/// parsing will be skipped, causing File.Scope, File.Unresolved, and
/// all Ident.Obj fields to be nil. Those fields are deprecated; see
/// [ast.Object] for details.
/// 
/// Position information is recorded in the file set fset, which must not be
/// nil.
/// 
/// If the source couldn't be read, the returned AST is nil and the error
/// indicates the specific failure. If the source was read but syntax
/// errors were found, the result is a partial AST (with [ast.Bad]* nodes
/// representing the fragments of erroneous source code). Multiple errors
/// are returned via a scanner.ErrorList which is sorted by source position.
pub fn ParseFile(
  fset: Ref<token.FileSet>,
  filename: string,
  src: Unknown,
  mode: Mode,
) -> Result<Ref<ast.File>, error>

/// A Mode value is a set of flags (or 0).
/// They control the amount of source code parsed and other optional
/// parser functionality.
pub struct Mode(uint)

const AllErrors: Mode = 32

const DeclarationErrors: Mode = 16

const ImportsOnly: Mode = 2

const PackageClauseOnly: Mode = 1

const ParseComments: Mode = 4

const SkipObjectResolution: Mode = 64

const SpuriousErrors: Mode = 32

const Trace: Mode = 8
