[][src]Struct bracket::parser::Parser

pub struct Parser<'source> { /* fields omitted */ }

Convert a lexer token stream to AST nodes.

The Parser is an Iterator that yields Node:

This example is not tested
let content = "A {{var}} template.";
let parser = Parser::new(content, Default::default());
for node in parser {
    println!("{:#?}", node.unwrap());
}

Implementations

impl<'source> Parser<'source>[src]

pub fn new(source: &'source str, options: ParserOptions) -> Self[src]

Create a new Parser for the given source template.

This will prepare a lexer and initial state for the iterator.

pub fn set_errors(&mut self, errors: &'source mut Vec<Error>)[src]

Set a list of errors that this parser should add compile time syntax errors to.

Changes the behavior of this parser to be infallible to support a lint operation.

pub fn parse(&mut self) -> SyntaxResult<Node<'source>>[src]

Parse the entire document into a node tree.

This iterates the parser until completion and adds each node to a Document node which is returned.

Trait Implementations

impl<'source> Iterator for Parser<'source>[src]

type Item = SyntaxResult<Node<'source>>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'source> !RefUnwindSafe for Parser<'source>

impl<'source> Send for Parser<'source>

impl<'source> Sync for Parser<'source>

impl<'source> Unpin for Parser<'source>

impl<'source> !UnwindSafe for Parser<'source>

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<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.