Enum badder_lang::Ast[][src]

pub enum Ast {
    Num(TokenSourceRef),
    BinOp(TokenBox<Ast>, Box<Ast>, SourceRef),
    LeftUnaryOp(TokenBox<Ast>, SourceRef),
    Assign(TokenBox<Ast>, SourceRef),
    Reassign(TokenBox<Ast>, SourceRef),
    Refer(TokenSourceRef),
    If(Box<Ast>, Arc<Ast>, Option<Box<Ast>>, boolSourceRef),
    While(Box<Ast>, Arc<Ast>, SourceRef),
    ForIn(Option<Token>, TokenBox<Ast>, Arc<Ast>, SourceRef),
    LoopNav(TokenSourceRef),
    AssignFun(TokenVec<Token>, Arc<Ast>, SourceRef),
    Return(Box<Ast>, SourceRef),
    Call(TokenVec<Ast>, SourceRef),
    Seq(Vec<Ast>, SourceRef),
    AssignSeq(TokenBox<Ast>, SourceRef),
    ReferSeq(TokenSourceRef),
    ReferSeqIndex(TokenBox<Ast>, SourceRef),
    ReassignSeqIndex(TokenBox<Ast>, Box<Ast>, SourceRef),
    Line(usizeBox<Ast>, SourceRef),
    LinePair(Box<Ast>, Box<Ast>, SourceRef),
    Empty(SourceRef),
}

Abstract syntax tree

Variants

BinOp(TokenBox<Ast>, Box<Ast>, SourceRef)
LeftUnaryOp(TokenBox<Ast>, SourceRef)
Assign(TokenBox<Ast>, SourceRef)

Assign(variable_id, ast)

Reassign(TokenBox<Ast>, SourceRef)
Refer(TokenSourceRef)

Refer(variable_id)

If(if-expr, resultant-block, Line(If), is_else)

While(Box<Ast>, Arc<Ast>, SourceRef)

While(if-expr, resultant-block)

ForIn(Option<Token>, TokenBox<Ast>, Arc<Ast>, SourceRef)

ForIn(index-id, item-id, list, block)

LoopNav(TokenSourceRef)

LoopNav(break|continue)

AssignFun(TokenVec<Token>, Arc<Ast>, SourceRef)

AssignFun(function-id, args, block) defines a function

Return(Box<Ast>, SourceRef)
Call(TokenVec<Ast>, SourceRef)

Call(function-id, args)

Seq(Vec<Ast>, SourceRef)

Literal sequence of expressions

AssignSeq(TokenBox<Ast>, SourceRef)

AssignSeq(seq-id, Seq)

ReferSeq(TokenSourceRef)

ReferSeq(seq-id) refer to a sequence

ReferSeqIndex(TokenBox<Ast>, SourceRef)

ReferSeqIndex(seq-id, index)

ReassignSeqIndex(TokenBox<Ast>, Box<Ast>, SourceRef)

ReassignSeqIndex(seq-id, index, val)

Line(usizeBox<Ast>, SourceRef)

Line(scope, expr)

LinePair(Box<Ast>, Box<Ast>, SourceRef)

LinePair(line, next_line)

Empty(SourceRef)

Implementations

impl Ast[src]

pub fn bin_op<A: Into<Box<Ast>>>(token: Token, left: A, right: A) -> Ast[src]

pub fn line_pair<A: Into<Box<Ast>>>(before: A, after: A) -> Ast[src]

pub fn just_if(expr: Ast, block: Ast, is_else: bool, if_start: SourceRef) -> Ast[src]

pub fn if_else(
    expr: Ast,
    block: Ast,
    else_if: Ast,
    is_else: bool,
    if_start: SourceRef
) -> Ast
[src]

pub fn num(n: Int, src: SourceRef) -> Ast[src]

pub fn debug_string(&self) -> String[src]

pub fn src(&self) -> SourceRef[src]

Trait Implementations

impl Clone for Ast[src]

impl Debug for Ast[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Safe for large recursive structures

impl Hash for Ast[src]

impl PartialEq<Ast> for Ast[src]

impl StructuralPartialEq for Ast[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.