Struct gallop::Parser
[−]
[src]
pub struct Parser<'a> { /* fields omitted */ }
Holds the state of the parser for the provided Grammar
Methods
impl<'a> Parser<'a>
[src]
fn new(grammar: &'a mut Grammar) -> Result<Parser<'a>, GrammarError<'a>>
[src]
Creates a Parser
from the provided Grammar
⚠Be careful when using this code, it's not being tested!
let parser = match Parser::new(&mut grammar) { Ok(p) => p, Err(err) => panic!("Error: {:#?}", err), };
fn parse(&mut self, input: &'a str) -> Result<ParseTree<'a>, ParseError>
[src]
Parse the provided string
⚠Be careful when using this code, it's not being tested!
println!("Parse tree: {:#?}", parser.parse("a test string"));
fn rollup(&mut self, non_terminals: Vec<NonTerminal<'a>>)
[src]
Specify any non-terminals that you want rolled up (see "Rolling Up the Parse Tree" section)
⚠Be careful when using this code, it's not being tested!
parser.rollup(vec![ "digit+", "digit*", ]);
Trait Implementations
impl<'a> Clone for Parser<'a>
[src]
fn clone(&self) -> Parser<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more