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]
impl<'a> Parser<'a>
pub fn new(grammar: &'a mut Grammar) -> Result<Parser<'a>, GrammarError<'a>>
[src]
pub fn new(grammar: &'a mut Grammar) -> Result<Parser<'a>, GrammarError<'a>>
Creates a Parser
from the provided Grammar
ⓘThis example is not tested
let parser = match Parser::new(&mut grammar) { Ok(p) => p, Err(err) => panic!("Error: {:#?}", err), };
pub fn parse(&mut self, input: &'a str) -> Result<ParseTree<'a>, ParseError>
[src]
pub fn parse(&mut self, input: &'a str) -> Result<ParseTree<'a>, ParseError>
Parse the provided string
ⓘThis example is not tested
println!("Parse tree: {:#?}", parser.parse("a test string"));
pub fn rollup(&mut self, non_terminals: Vec<NonTerminal<'a>>)
[src]
pub fn rollup(&mut self, non_terminals: Vec<NonTerminal<'a>>)
Specify any non-terminals that you want rolled up (see "Rolling Up the Parse Tree" section)
ⓘThis example is not tested
parser.rollup(vec![ "digit+", "digit*", ]);
Trait Implementations
impl<'a> Clone for Parser<'a>
[src]
impl<'a> Clone for Parser<'a>
fn clone(&self) -> Parser<'a>
[src]
fn clone(&self) -> Parser<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<'a> Debug for Parser<'a>
[src]
impl<'a> Debug for Parser<'a>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a> PartialEq for Parser<'a>
[src]
impl<'a> PartialEq for Parser<'a>