Enum passerine::compiler::ast::AST [−][src]
pub enum AST {
Show 14 variants
Symbol(String),
Data(Data),
Block(Vec<Spanned<AST>>),
Form(Vec<Spanned<AST>>),
Group(Box<Spanned<AST>>),
CSTPattern(ASTPattern),
ArgPattern(ArgPattern),
Tuple(Vec<Spanned<AST>>),
Assign {
pattern: Box<Spanned<ASTPattern>>,
expression: Box<Spanned<AST>>,
},
Lambda {
pattern: Box<Spanned<ASTPattern>>,
expression: Box<Spanned<AST>>,
},
Composition {
argument: Box<Spanned<AST>>,
function: Box<Spanned<AST>>,
},
Label(String, Box<Spanned<AST>>),
Syntax {
arg_pat: Box<Spanned<ArgPattern>>,
expression: Box<Spanned<AST>>,
},
FFI {
name: String,
expression: Box<Spanned<AST>>,
},
}
Expand description
Represents an item in a sugared AST
.
Which is the direct result of parsing
Each syntax-level construct has it’s own AST
variant.
When macros are added, for instance, they will be here,
But not in the CST
, which is the desugared syntax tree,
and represents language-level constructs
Variants
Symbol(String)
Tuple Fields of Symbol
0: String
Data(Data)
Tuple Fields of Data
0: Data
CSTPattern(ASTPattern)
Tuple Fields of CSTPattern
0: ASTPattern
ArgPattern(ArgPattern)
Tuple Fields of ArgPattern
0: ArgPattern
Implementations
Shortcut for creating an AST::Assign
variant.
Shortcut for creating an AST::Lambda
variant.
Shortcut for creating an AST::Composition
variant.
Shortcut for creating an AST::Syntax
variant.
i.e. a macro definition
Shortcut for creating a AST::Label
variant.
Shortcut for creating an AST::FFI
variant.
Trait Implementations
Tries to convert an AST
into a CSTPattern
.
CSTPatterns mirror the AST
s they are designed to destructure.
During parsing, they are just parsed as AST
s -
When the compiler can determine that an AST is actually a pattern,
It performs this conversion.
Auto Trait Implementations
impl !RefUnwindSafe for AST
impl !UnwindSafe for AST
Blanket Implementations
Mutably borrows from an owned value. Read more