Crate rustpython_ast
source ·Expand description
Python AST node definitions and utilities.
AST nodes are very similary defined like Python AST. But a few exceptions exist due to parser optimization. They can be transformed to matching Python-styled AST in reasonable cost.
PythonArguments is replaced by Arguments. The new Arguments type representation uses a new type ArgWithDefault to represent arguments with default values. See each type documentation for more details.
A few top-level sum types are renamed to human friendly names.
CmpOp refers cmpop
UnaryOp refers unaryop
BoolOp refers boolop
WithItem refers withitem
ExceptHandler refers excepthandler
Re-exports§
pub use fold::Fold;
pub use crate::Node;
pub use malachite_bigint as bigint;
Modules§
- Newtypes for working with text sizes/ranges in a more type-safe manner.
Structs§
- See also alias
- See also arg
- An alternative type of AST
arg
. This is used for each function argument that might have a default value. Used byArguments
original type. - An alternative type of AST
arguments
. This is parser-friendly and human-friendly definition of function arguments. This form also has advantage to implement pre-order traverse.defaults
andkw_defaults
fields are removed and the default values are placed under eacharg_with_default
typed argument.vararg
andkwarg
are still typed asarg
because they never can have a default value. - See also comprehension
- See also ExceptHandler
- See also Attribute
- See also Await
- See also BinOp
- See also BoolOp
- See also Call
- See also Compare
- See also Constant
- See also Dict
- See also DictComp
- See also FormattedValue
- See also GeneratorExp
- See also IfExp
- See also JoinedStr
- See also Lambda
- See also List
- See also ListComp
- See also Name
- See also NamedExpr
- See also Set
- See also SetComp
- See also Slice
- See also Starred
- See also Subscript
- See also Tuple
- See also UnaryOp
- See also Yield
- See also YieldFrom
- See also keyword
- See also match_case
- See also Expression
- See also FunctionType
- See also Interactive
- See also Module
- See also MatchAs
- See also MatchClass
- See also MatchMapping
- See also MatchOr
- See also MatchSequence
- See also MatchSingleton
- See also MatchStar
- See also MatchValue
- See also arguments
- See also AnnAssign
- See also Assert
- See also Assign
- See also AsyncFor
- See also AsyncFunctionDef
- See also AsyncWith
- See also AugAssign
- See also Break
- See also ClassDef
- See also Continue
- See also Delete
- See also Expr
- See also For
- See also FunctionDef
- See also Global
- See also If
- See also Import
- See also ImportFrom
- See also Match
- See also Nonlocal
- See also Pass
- See also Raise
- See also Return
- See also Try
- See also TryStar
- See also TypeAlias
- See also While
- See also With
- A measure of text length. Also, equivalently, an index into text.
- See also TypeIgnore
- See also ParamSpec
- See also TypeVar
- See also TypeVarTuple
- See also withitem
Enums§
- See also boolop
- See also cmpop
- Transforms a value prior to formatting it.
- See also excepthandler
- See also expr
- See also expr_context
- See also mod
- See also operator
- See also pattern
- See also stmt
- See also type_ignore
- See also type_param
- See also unaryop