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

/// GoVersion returns the minimum Go version implied by a given build expression.
/// If the expression can be satisfied without any Go version tags, GoVersion returns an empty string.
/// 
/// For example:
/// 
/// 	GoVersion(linux && go1.22) = "go1.22"
/// 	GoVersion((linux && go1.22) || (windows && go1.20)) = "go1.20" => go1.20
/// 	GoVersion(linux) = ""
/// 	GoVersion(linux || (windows && go1.22)) = ""
/// 	GoVersion(!go1.22) = ""
/// 
/// GoVersion assumes that any tag or negated tag may independently be true,
/// so that its analysis can be purely structural, without SAT solving.
/// “Impossible” subexpressions may therefore affect the result.
/// 
/// For example:
/// 
/// 	GoVersion((linux && !linux && go1.20) || go1.21) = "go1.20"
pub fn GoVersion(x: Expr) -> string

/// IsGoBuild reports whether the line of text is a “//go:build” constraint.
/// It only checks the prefix of the text, not that the expression itself parses.
pub fn IsGoBuild(line: string) -> bool

/// IsPlusBuild reports whether the line of text is a “// +build” constraint.
/// It only checks the prefix of the text, not that the expression itself parses.
pub fn IsPlusBuild(line: string) -> bool

pub fn Parse(line: string) -> Result<Expr, error>

/// PlusBuildLines returns a sequence of “// +build” lines that evaluate to the build expression x.
/// If the expression is too complex to convert directly to “// +build” lines, PlusBuildLines returns an error.
pub fn PlusBuildLines(x: Expr) -> Result<Slice<string>, error>

/// An AndExpr represents the expression X && Y.
pub struct AndExpr {
  pub X: Option<Expr>,
  pub Y: Option<Expr>,
}

/// An Expr is a build tag constraint expression.
/// The underlying concrete type is *[AndExpr], *[OrExpr], *[NotExpr], or *[TagExpr].
pub interface Expr {
  fn Eval(ok: fn(string) -> bool) -> bool
  fn String() -> string
}

/// A NotExpr represents the expression !X (the negation of X).
pub struct NotExpr {
  pub X: Option<Expr>,
}

/// An OrExpr represents the expression X || Y.
pub struct OrExpr {
  pub X: Option<Expr>,
  pub Y: Option<Expr>,
}

/// A SyntaxError reports a syntax error in a parsed build expression.
pub struct SyntaxError {
  pub Offset: int,
  pub Err: string,
}

/// A TagExpr is an [Expr] for the single tag Tag.
pub struct TagExpr {
  pub Tag: string,
}

impl AndExpr {
  fn Eval(self: Ref<AndExpr>, ok: fn(string) -> bool) -> bool

  fn String(self: Ref<AndExpr>) -> string
}

impl NotExpr {
  fn Eval(self: Ref<NotExpr>, ok: fn(string) -> bool) -> bool

  fn String(self: Ref<NotExpr>) -> string
}

impl OrExpr {
  fn Eval(self: Ref<OrExpr>, ok: fn(string) -> bool) -> bool

  fn String(self: Ref<OrExpr>) -> string
}

impl SyntaxError {
  fn Error(self: Ref<SyntaxError>) -> string
}

impl TagExpr {
  fn Eval(self: Ref<TagExpr>, ok: fn(string) -> bool) -> bool

  fn String(self: Ref<TagExpr>) -> string
}
