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)
Data(Data)
Block(Vec<Spanned<AST>>)
Form(Vec<Spanned<AST>>)
Group(Box<Spanned<AST>>)
CSTPattern(ASTPattern)
ArgPattern(ArgPattern)
Tuple(Vec<Spanned<AST>>)
Assign
Lambda
Composition
Label(String, Box<Spanned<AST>>)
Syntax
FFI
Implementations§
Source§impl AST
impl AST
Sourcepub fn assign(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST
pub fn assign(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST
Shortcut for creating an AST::Assign
variant.
Sourcepub fn lambda(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST
pub fn lambda(pattern: Spanned<ASTPattern>, expression: Spanned<AST>) -> AST
Shortcut for creating an AST::Lambda
variant.
Sourcepub fn composition(argument: Spanned<AST>, function: Spanned<AST>) -> AST
pub fn composition(argument: Spanned<AST>, function: Spanned<AST>) -> AST
Shortcut for creating an AST::Composition
variant.
Sourcepub fn syntax(arg_pat: Spanned<ArgPattern>, expression: Spanned<AST>) -> AST
pub fn syntax(arg_pat: Spanned<ArgPattern>, expression: Spanned<AST>) -> AST
Shortcut for creating an AST::Syntax
variant.
i.e. a macro definition
Sourcepub fn label(name: &str, expression: Spanned<AST>) -> AST
pub fn label(name: &str, expression: Spanned<AST>) -> AST
Shortcut for creating a AST::Label
variant.
Trait Implementations§
Source§impl TryFrom<AST> for ASTPattern
impl TryFrom<AST> for ASTPattern
Source§fn try_from(ast: AST) -> Result<Self, Self::Error>
fn try_from(ast: AST) -> Result<Self, Self::Error>
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.