[][src]Struct full_moon::ast::Ast

pub struct Ast<'a> { /* fields omitted */ }

An abstract syntax tree, contains all the nodes used in the code

Methods

impl<'a> Ast<'a>[src]

pub fn from_tokens(tokens: Vec<Token<'a>>) -> Result<Ast<'a>, AstError<'a>>[src]

Create an Ast from the passed tokens. You probably want parse

Errors

If the tokens passed are impossible to get through normal tokenization, an error of Empty (if the vector is empty) or NoEof (if there is no eof token) will be returned.

More likely, if the tokens pass are invalid Lua 5.1 code, an UnexpectedToken error will be returned.

pub fn nodes(&self) -> &Block<'a>[src]

The entire code of the function

assert_eq!(full_moon::parse("local x = 1; local y = 2")?.nodes().iter_stmts().count(), 2);

pub fn nodes_mut(&mut self) -> &mut Block<'a>[src]

The entire code of the function, but mutable

pub fn iter_tokens(&self) -> impl Iterator<Item = &Token<'a>>[src]

An iterator over the tokens used to create the Ast

Trait Implementations

impl<'a> PartialEq<Ast<'a>> for Ast<'a>[src]

impl<'a> Clone for Ast<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for Ast<'a>[src]

Auto Trait Implementations

impl<'a> Send for Ast<'a>

impl<'a> Sync for Ast<'a>

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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

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

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