pub enum RuchyNode {
Show 34 variants
Module(Vec<RuchyNode>),
FnDef {
name: String,
params: Vec<(String, RuchyType)>,
return_type: Option<RuchyType>,
body: Vec<RuchyNode>,
},
Let {
name: String,
ty: Option<RuchyType>,
value: Box<RuchyNode>,
mutable: bool,
},
Assign {
target: Box<RuchyNode>,
value: Box<RuchyNode>,
},
BinOp {
left: Box<RuchyNode>,
op: RuchyBinaryOp,
right: Box<RuchyNode>,
},
UnaryOp {
op: RuchyUnaryOp,
operand: Box<RuchyNode>,
},
IntLit(i64),
FloatLit(f64),
StrLit(String),
BoolLit(bool),
Ident(String),
If {
cond: Box<RuchyNode>,
then_body: Vec<RuchyNode>,
else_body: Vec<RuchyNode>,
},
Match {
value: Box<RuchyNode>,
arms: Vec<(RuchyNode, Vec<RuchyNode>)>,
},
While {
cond: Box<RuchyNode>,
body: Vec<RuchyNode>,
},
For {
var: String,
iter: Box<RuchyNode>,
body: Vec<RuchyNode>,
},
Return(Option<Box<RuchyNode>>),
Break,
Continue,
Call {
func: Box<RuchyNode>,
args: Vec<RuchyNode>,
},
MethodCall {
receiver: Box<RuchyNode>,
method: String,
args: Vec<RuchyNode>,
},
StructDef {
name: String,
fields: Vec<(String, RuchyType)>,
},
StructInit {
name: String,
fields: Vec<(String, RuchyNode)>,
},
FieldAccess {
receiver: Box<RuchyNode>,
field: String,
},
OptionalChain {
receiver: Box<RuchyNode>,
field: String,
},
Pipeline {
left: Box<RuchyNode>,
right: Box<RuchyNode>,
},
Array(Vec<RuchyNode>),
Range {
start: Box<RuchyNode>,
end: Box<RuchyNode>,
inclusive: bool,
},
Closure {
params: Vec<String>,
body: Box<RuchyNode>,
},
Block(Vec<RuchyNode>),
Spawn(Box<RuchyNode>),
Send {
target: Box<RuchyNode>,
message: Box<RuchyNode>,
},
Compare {
left: Box<RuchyNode>,
op: RuchyCompareOp,
right: Box<RuchyNode>,
},
NullCoalesce {
value: Box<RuchyNode>,
default: Box<RuchyNode>,
},
Pattern(RuchyPattern),
}Expand description
Ruchy AST node types for generation
Variants§
Module(Vec<RuchyNode>)
Module (root node)
FnDef
Function definition
Fields
Let
Let binding
Fields
Assign
Assignment
BinOp
Binary operation
Fields
§
op: RuchyBinaryOpOperator
UnaryOp
Unary operation
IntLit(i64)
Integer literal
FloatLit(f64)
Float literal
StrLit(String)
String literal
BoolLit(bool)
Boolean literal
Ident(String)
Identifier
If
If expression
Fields
Match
Match expression
Fields
While
While loop
For
For loop (for x in iter)
Return(Option<Box<RuchyNode>>)
Return expression
Break
Break expression
Continue
Continue expression
Call
Function call
MethodCall
Method call
StructDef
Struct definition
StructInit
Struct instantiation
FieldAccess
Field access
OptionalChain
Optional chaining (?.)
Pipeline
Pipeline operator (|>)
Array(Vec<RuchyNode>)
Array literal
Range
Range (start..end)
Closure
Closure
Block(Vec<RuchyNode>)
Block expression
Spawn(Box<RuchyNode>)
Actor spawn
Send
Send message
Compare
Comparison
Fields
§
op: RuchyCompareOpOperator
NullCoalesce
Null coalescing (??)
Pattern(RuchyPattern)
Pattern for match
Implementations§
Trait Implementations§
impl StructuralPartialEq for RuchyNode
Auto Trait Implementations§
impl Freeze for RuchyNode
impl RefUnwindSafe for RuchyNode
impl Send for RuchyNode
impl Sync for RuchyNode
impl Unpin for RuchyNode
impl UnsafeUnpin for RuchyNode
impl UnwindSafe for RuchyNode
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