[−][src]Struct leo_grammar::Grammar
The pest abstract syntax tree (ast) for a Leo program.
The Grammar
type represents a Leo program as a series of recursive data types.
These data types form a tree that begins from a [File
] type root.
A new Grammar
type can be created from a *.leo
file at a Path
.
A Grammar
type can be used to create a new [Ast
] type.
Implementations
impl<'ast> Grammar<'ast>
[src]
pub fn new(
file_path: &'ast Path,
program_string: &'ast str
) -> Result<Self, ParserError>
[src]
file_path: &'ast Path,
program_string: &'ast str
) -> Result<Self, ParserError>
Creates a new abstract syntax tree given the file path.
pub fn load_file(file_path: &'ast Path) -> Result<String, ParserError>
[src]
Loads the Leo code as a string from the given file path.
pub fn as_repr(&self) -> &File<'ast>
[src]
Returns a reference to the inner abstract syntax tree representation.
pub fn to_json_string(&self) -> Result<String, ParserError>
[src]
Serializes the abstract syntax tree into a JSON string.
Auto Trait Implementations
impl<'ast> RefUnwindSafe for Grammar<'ast>
[src]
impl<'ast> Send for Grammar<'ast>
[src]
impl<'ast> Sync for Grammar<'ast>
[src]
impl<'ast> Unpin for Grammar<'ast>
[src]
impl<'ast> UnwindSafe for Grammar<'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<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>,