Struct leo_asg::Ast[][src]

pub struct Ast { /* fields omitted */ }

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_name: &str, grammar: &Grammar<'ast>) -> Result<Ast, AstError>[src]

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<Ast, 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

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

impl<T> Instrument for T[src]

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.