connect0459/starlark/syntax does not have a README file

    Arg

    pub(all) enum Arg {
    ArgPos(Expr)
    ArgKw(String, Expr,
    Position
    )
    ArgStarArgs(Expr)
    ArgKwArgs(Expr)
    }

    AugOp

    pub(all) enum AugOp {
    AugAdd
    AugSub
    AugMul
    AugDiv
    AugFloorDiv
    AugMod
    AugBitAnd
    AugBitOr
    AugBitXor
    AugLShift
    AugRShift
    }

    BinaryOp

    pub(all) enum BinaryOp {
    OpAdd
    OpSub
    OpMul
    OpDiv
    OpFloorDiv
    OpMod
    OpBitAnd
    OpBitOr
    OpBitXor
    OpLShift
    OpRShift
    OpEq
    OpNe
    OpLt
    OpLe
    OpGt
    OpGe
    OpIn
    OpNotIn
    OpAnd
    OpOr
    }

    File

    pub struct File {
    // private fields
    }

    A parsed Starlark source file: its filename and top-level statement list.

    File::new

    fn File::new(path : String, stmts : Array[Stmt]) -> File

    Constructs a File with the given source path and top-level statement list.

    Parameters:

    • path : The source file path recorded in the AST.
    • stmts : The top-level statements parsed from the file.

    Returns a new File AST node.

    File::path

    fn File::path(self : File) -> String

    Returns the source file path.

    Parameters:

    • self : The file node to inspect.

    Returns the path string recorded in this File.

    File::stmts

    fn File::stmts(self : File) -> Array[Stmt]

    Returns the top-level statement list.

    Parameters:

    • self : The file node to inspect.

    Returns the array of top-level Stmt nodes in this file.

    LiteralVal

    pub(all) enum LiteralVal {
    LitNone
    LitBool(Bool)
    LitInt(
    BigInt
    )
    LitFloat(Double)
    LitString(String)
    LitBytes(Bytes)
    }

    Node

    pub(all) enum Node {
    NFile(File)
    NStmt(Stmt)
    NExpr(Expr)
    NParam(Param)
    NArg(Arg)
    NCompClause(CompClause)
    }

    A tagged union of every AST node kind, used as the argument to the visitor function passed to walk_file/walk_stmt/walk_expr.

    UnaryOp

    pub(all) enum UnaryOp {
    OpPlus
    OpMinus
    OpBitNot
    OpNot
    }

    expr_pos

    Returns the source position of an expression node.

    Parameters:

    • e : The expression node to inspect.

    Returns the Position stored in the expression's position slot.

    stmt_pos

    Returns the source position of a statement node.

    Parameters:

    • s : The statement node to inspect.

    Returns the Position stored in the statement's position slot.

    walk_expr

    fn walk_expr(expr : Expr, f : (Node?) -> Bool) -> Unit

    Performs a depth-first walk of an expression and all its sub-expressions.

    Parameters:

    • expr : The expression node to walk.
    • f : Visitor callback; receives Some(node) on entry and None on exit of each parent. Return false to skip a subtree.

    walk_file

    fn walk_file(file : File, f : (Node?) -> Bool) -> Unit

    Performs a depth-first walk of a parsed Starlark file, calling f before descending into each node. If f returns false, the subtree is skipped. f(None) is called after the last child of every parent.

    Parameters:

    • file : The parsed file whose nodes are visited.
    • f : Visitor callback; receives Some(node) on entry and None on exit of each parent. Return false to skip a subtree.

    walk_stmt

    fn walk_stmt(stmt : Stmt, f : (Node?) -> Bool) -> Unit

    Performs a depth-first walk of a statement and all its sub-expressions.

    Parameters:

    • stmt : The statement node to walk.
    • f : Visitor callback; receives Some(node) on entry and None on exit of each parent. Return false to skip a subtree.