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(StringBox<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
Block(Vec<Spanned<AST>>)

Tuple Fields of Block

0: Vec<Spanned<AST>>
Form(Vec<Spanned<AST>>)

Tuple Fields of Form

0: Vec<Spanned<AST>>
Group(Box<Spanned<AST>>)

Tuple Fields of Group

0: Box<Spanned<AST>>
CSTPattern(ASTPattern)

Tuple Fields of CSTPattern

0: ASTPattern
ArgPattern(ArgPattern)

Tuple Fields of ArgPattern

0: ArgPattern
Tuple(Vec<Spanned<AST>>)

Tuple Fields of Tuple

0: Vec<Spanned<AST>>
Assign

Fields of Assign

pattern: Box<Spanned<ASTPattern>>expression: Box<Spanned<AST>>
Lambda

Fields of Lambda

pattern: Box<Spanned<ASTPattern>>expression: Box<Spanned<AST>>
Composition

Fields of Composition

argument: Box<Spanned<AST>>function: Box<Spanned<AST>>
Label(StringBox<Spanned<AST>>)

Tuple Fields of Label

0: String1: Box<Spanned<AST>>
Syntax

Fields of Syntax

arg_pat: Box<Spanned<ArgPattern>>expression: Box<Spanned<AST>>
FFI

Fields of FFI

name: Stringexpression: Box<Spanned<AST>>

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.

Shortcut for creating an AST::Group variant.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Like ASTPatterns, ArgPatterns are represented as ASTs, Then converted into ArgPatterns when the compiler determines it so.

The type returned in the event of a conversion error.

Tries to convert an AST into a CSTPattern. CSTPatterns mirror the ASTs they are designed to destructure. During parsing, they are just parsed as ASTs - When the compiler can determine that an AST is actually a pattern, It performs this conversion.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.