Struct leo_asg::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(program: Program) -> Ast
[src]
Creates a new AST from a given program tree.
pub fn canonicalize(&mut self) -> Result<(), CanonicalizeError>
[src]
Mutates the program ast by preforming canonicalization on it.
pub fn as_repr(&self) -> &Program
[src]
Returns a reference to the inner program AST representation.
pub fn into_repr(self) -> Program
[src]
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<Ast, Error>
[src]
Deserializes the JSON string into a ast.
Trait Implementations
impl AsRef<Program> for Ast
[src]
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
impl !Send for Ast
impl !Sync for Ast
impl Unpin for Ast
impl UnwindSafe for Ast
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>,