pub enum Node {
Show 38 variants
Identifier(Leaf<String>),
Numb(Leaf<f64>),
Text(Leaf<String>),
Nothing(Leaf<()>),
Unclosed(Leaf<char>),
UnexpectedToken(Leaf<String>),
List(UnaryOp),
Namespace(UnaryOp),
AffirmOp(UnaryOp),
NegateOp(UnaryOp),
LogicalNegationOp(UnaryOp),
LiftingOp(UnaryOp),
FunctionDefinitionOp(BinaryOp),
ApplicationOp(BinaryOp),
PairingOp(BinaryOp),
MappingOp(BinaryOp),
AssignmentOp(BinaryOp),
LabellingOp(BinaryOp),
SubcontextingOp(BinaryOp),
ThenOp(BinaryOp),
PowerOp(BinaryOp),
ProductOp(BinaryOp),
DivisionOp(BinaryOp),
ModuloOp(BinaryOp),
SumOp(BinaryOp),
SubtractionOp(BinaryOp),
EqualToOp(BinaryOp),
NotEqualToOp(BinaryOp),
LessThanOp(BinaryOp),
LessThanOrEqualToOp(BinaryOp),
GreaterThanOp(BinaryOp),
GreaterThanOrEqualToOp(BinaryOp),
AndOp(BinaryOp),
OrOp(BinaryOp),
ConditionalOp(BinaryOp),
AlternativeOp(BinaryOp),
CompositionOp(BinaryOp),
ReverseCompositionOp(BinaryOp),
}Expand description
A node of the Swan syntax tree.
The comment on each variant shows the syntax that produces it.
Variants§
Identifier(Leaf<String>)
A name, such as x or my_var.
Numb(Leaf<f64>)
A number literal, such as 42 or 1.5e-3.
Text(Leaf<String>)
A text literal, such as "hello". The value excludes the quotes.
Nothing(Leaf<()>)
(), or an empty expression.
Unclosed(Leaf<char>)
Syntax error: a group that is not closed. The value is the missing
closing bracket (), ] or }).
UnexpectedToken(Leaf<String>)
Syntax error: a token that cannot appear where it was found. The value is a debug description of the token.
List(UnaryOp)
[X]: a list literal.
Namespace(UnaryOp)
{X}: a namespace literal.
AffirmOp(UnaryOp)
+X
NegateOp(UnaryOp)
-X
LogicalNegationOp(UnaryOp)
!X
LiftingOp(UnaryOp)
$X
FunctionDefinitionOp(BinaryOp)
X -> Y
ApplicationOp(BinaryOp)
X Y: function application, written by juxtaposition.
PairingOp(BinaryOp)
X , Y
MappingOp(BinaryOp)
X => Y
AssignmentOp(BinaryOp)
X = Y
LabellingOp(BinaryOp)
X : Y
SubcontextingOp(BinaryOp)
X . Y
ThenOp(BinaryOp)
X ~> Y
PowerOp(BinaryOp)
X ^ Y
ProductOp(BinaryOp)
X * Y
DivisionOp(BinaryOp)
X / Y
ModuloOp(BinaryOp)
X % Y
SumOp(BinaryOp)
X + Y
SubtractionOp(BinaryOp)
X - Y
EqualToOp(BinaryOp)
X == Y
NotEqualToOp(BinaryOp)
X != Y
LessThanOp(BinaryOp)
X < Y
LessThanOrEqualToOp(BinaryOp)
X <= Y
GreaterThanOp(BinaryOp)
X > Y
GreaterThanOrEqualToOp(BinaryOp)
X >= Y
AndOp(BinaryOp)
X & Y
OrOp(BinaryOp)
X | Y
ConditionalOp(BinaryOp)
X ? Y
AlternativeOp(BinaryOp)
X ; Y
CompositionOp(BinaryOp)
X << Y
ReverseCompositionOp(BinaryOp)
X >> Y
Implementations§
Trait Implementations§
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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