[−][src]Struct full_moon::ast::Ast
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
pub fn update_positions(&mut self)
[src]
Will update the positions of all the tokens in the tree Necessary if you are both mutating the tree and need the positions of the tokens
Trait Implementations
impl<'_> Owned for Ast<'_>
[src]
type Owned = Ast<'static>
What an owned version of the object looks like. Usually contains a 'static
lifetime.
fn owned(&self) -> Self::Owned
[src]
impl<'a> Clone for Ast<'a>
[src]
impl<'a> Debug for Ast<'a>
[src]
Auto Trait Implementations
impl<'a> Send for Ast<'a>
impl<'a> Sync for Ast<'a>
impl<'a> Unpin for Ast<'a>
impl<'a> !UnwindSafe for Ast<'a>
impl<'a> !RefUnwindSafe for Ast<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,