pub enum PythonNode {
Show 21 variants
Module(Vec<PythonNode>),
Assign {
target: String,
value: Box<PythonNode>,
},
BinOp {
left: Box<PythonNode>,
op: BinaryOp,
right: Box<PythonNode>,
},
UnaryOp {
op: UnaryOp,
operand: Box<PythonNode>,
},
IntLit(i64),
FloatLit(f64),
StrLit(String),
BoolLit(bool),
NoneLit,
Name(String),
If {
test: Box<PythonNode>,
body: Vec<PythonNode>,
orelse: Vec<PythonNode>,
},
While {
test: Box<PythonNode>,
body: Vec<PythonNode>,
},
For {
target: String,
iter: Box<PythonNode>,
body: Vec<PythonNode>,
},
FuncDef {
name: String,
args: Vec<String>,
body: Vec<PythonNode>,
},
Call {
func: String,
args: Vec<PythonNode>,
},
Return(Option<Box<PythonNode>>),
Pass,
Break,
Continue,
List(Vec<PythonNode>),
Compare {
left: Box<PythonNode>,
op: CompareOp,
right: Box<PythonNode>,
},
}Expand description
Python AST node types for generation
Variants§
Module(Vec<PythonNode>)
Module (root node)
Assign
Assignment statement: name = expr
BinOp
Binary operation: left op right
UnaryOp
Unary operation: op operand
IntLit(i64)
Integer literal
FloatLit(f64)
Float literal
StrLit(String)
String literal
BoolLit(bool)
Boolean literal
NoneLit
None literal
Name(String)
Variable reference
If
If statement
Fields
§
test: Box<PythonNode>Condition expression
§
body: Vec<PythonNode>If body statements
§
orelse: Vec<PythonNode>Else body statements
While
While loop
For
For loop
FuncDef
Function definition
Fields
§
body: Vec<PythonNode>Function body statements
Call
Function call
Return(Option<Box<PythonNode>>)
Return statement
Pass
Pass statement
Break
Break statement
Continue
Continue statement
List(Vec<PythonNode>)
List literal
Compare
Comparison: left op right
Implementations§
Trait Implementations§
Source§impl Clone for PythonNode
impl Clone for PythonNode
Source§fn clone(&self) -> PythonNode
fn clone(&self) -> PythonNode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PythonNode
impl Debug for PythonNode
Source§impl PartialEq for PythonNode
impl PartialEq for PythonNode
impl StructuralPartialEq for PythonNode
Auto Trait Implementations§
impl Freeze for PythonNode
impl RefUnwindSafe for PythonNode
impl Send for PythonNode
impl Sync for PythonNode
impl Unpin for PythonNode
impl UnsafeUnpin for PythonNode
impl UnwindSafe for PythonNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more