Struct leo_ast::Ast [−][src]
The abstract syntax tree (AST) for a Leo program.
The Ast
type represents a Leo program as a series of recursive data types.
These data types form a tree that begins from a Program
type root.
A new Ast
can be created from a Grammar
generated by the pest parser in the grammar
module.
Implementations
impl Ast
[src]
pub fn new<'ast>(
program_name: &str,
grammar: &Grammar<'ast>
) -> Result<Self, AstError>
[src]
program_name: &str,
grammar: &Grammar<'ast>
) -> Result<Self, AstError>
Creates a new AST from a given program name and grammar tree.
pub fn as_repr(&self) -> &Program
[src]
Returns a reference to the inner program AST representation.
pub fn to_json_string(&self) -> Result<String, Error>
[src]
Serializes the ast into a JSON string.
pub fn from_json_string(json: &str) -> Result<Self, Error>
[src]
Deserializes the JSON string into a ast.
Trait Implementations
impl Debug for Ast
[src]
impl Eq for Ast
[src]
impl PartialEq<Ast> for Ast
[src]
impl StructuralEq for Ast
[src]
impl StructuralPartialEq for Ast
[src]
Auto Trait Implementations
impl RefUnwindSafe for Ast
[src]
impl Send for Ast
[src]
impl Sync for Ast
[src]
impl Unpin for Ast
[src]
impl UnwindSafe for Ast
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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>,