package
8.0.3+incompatible
Repository: https://github.com/bazelbuild/buildtools.git
Documentation: pkg.go.dev

# Functions

Edit walks the expression tree v, calling f on all subexpressions in a preorder traversal.
EditChildren is similar to Edit but doesn't visit the initial node, instead goes directly to its children.
Format rewrites the file and returns the formatted form of it.
FormatString returns the string form of the given expression.
FormatWithoutRewriting returns the formatted form of the given Starlark file.
FormatWithRewriter rewites the file with custom rewriter and returns the formatted form of it.
GetParamIdent extracts the param identifier from an item of function params.
GetParamName extracts the param name from an item of function params.
GetTypes returns the list of types defined by the a given expression.
IsCorrectEscaping reports whether a string doesn't contain any incorrectly escaped sequences such as "\a".
NewRule is a simple constructor for Rule.
Parse parses the input data and returns the corresponding parse tree.
ParseBuild parses a file, marks it as a BUILD file and returns the corresponding parse tree.
ParseBzl parses a file, marks it as a .bzl file and returns the corresponding parse tree.
ParseDefault parses a file, marks it as a generic Starlark file and returns the corresponding parse tree.
ParseModule parses a file, marks it as a MODULE.bazel file and returns the corresponding parse tree.
ParseWorkspace parses a file, marks it as a WORKSPACE file and returns the corresponding parse tree.
Rewrite applies rewrites to a file.
SortLoadArgs sorts a load statement arguments (lexicographically, but positional first).
SortStringList sorts x, a list of strings.
Strings returns expr as a []string.
Unquote unquotes the quoted string, returning the actual string value, whether the original was triple-quoted, and an error describing invalid input.
Walk walks the expression tree v, calling f on all subexpressions in a preorder traversal.
WalkInterruptable is the same as Walk but allows traversal to be interrupted.
WalkOnce calls f on every child of v.
WalkPointers is the same as Walk but calls the callback function with pointers to nodes.
WalkStatements traverses sub statements (not all nodes).

# Constants

No description provided by the author
TypeBuild represents BUILD files.
TypeBzl represents .bzl files.
TypeDefault represents general Starlark files.
TypeModule represents MODULE.bazel and *.MODULE.bazel files.
TypeWorkspace represents WORKSPACE files.

# Variables

AllowSort allows sorting of these lists even with sorting otherwise disabled (for debugging).
DisableRewrites disables certain rewrites (for debugging).

# Structs

An AssignExpr represents a binary expression with `=`: LHS = RHS.
A BinaryExpr represents a binary expression: X Op Y.
BranchStmt represents a `pass`, `break`, or `continue` statement.
A CallExpr represents a function call expression: X(List).
A Comment represents a single # comment.
A CommentBlock represents a top-level block of comments separate from any rule.
Comments collects the comments associated with an expression.
A Comprehension represents a list comprehension expression: [X for ..
ConditionalExpr represents the conditional: X if TEST else ELSE.
A DefStmt represents a function definition expression: def foo(List):.
A DictExpr represents a dictionary literal: { List }.
A DotExpr represents a field selector: X.Name.
An End represents the end of a parenthesized or bracketed expression.
A File represents an entire BUILD or .bzl file.
A ForClause represents a for clause in a list comprehension: for Var in Expr.
A ForStmt represents a for loop block: for x in range(10):.
A Function represents the common parts of LambdaExpr and DefStmt.
An Ident represents an identifier.
An IfClause represents an if clause in a list comprehension: if Cond.
An IfStmt represents an if-else block: if x: ..
An IndexExpr represents an index expression: X[Y].
A KeyValueExpr represents a dictionary entry: Key: Value.
A LambdaExpr represents a lambda expression: lambda Var: Expr.
A ListExpr represents a list literal: [ List ].
A LiteralExpr represents a literal number.
A LoadStmt loads another module and binds names from it: load(Module, "x", y="foo").
A ParenExpr represents a parenthesized expression: (X).
ParseError contains information about the error encountered during parsing.
A Position describes the position between two bytes of input.
A ReturnStmt represents a return statement: return f(x).
Rewriter controls the rewrites to be applied.
A Rule represents a single BUILD rule.
A SetExpr represents a set literal: { List }.
A SliceExpr represents a slice expression: expr[from:to] or expr[from:to:step] .
StopTraversalError is a special error that tells the walker to not traverse further and visit child nodes of the current node.
A StringExpr represents a single literal string.
A TupleExpr represents a tuple literal: (List).
An TypedIdent represents an identifier with type annotation: "foo: int".
A UnaryExpr represents a unary expression: Op X.

# Interfaces

An Expr represents an input element.

# Type aliases

FileType represents a type of a file (default (for .bzl files), BUILD, or WORKSPACE).