Struct pidgin::Match [−][src]
pub struct Match<'t> { /* fields omitted */ }This is a node in a parse tree. It is functionally similar to regex::Match,
in fact providing much the same API, but unlike a regex::Match a pidgin::Match
always corresponds to some rule, it knows what rule it corresponds to,
and it records any sub-matches involved in its parsing.
The lifetime parameter 't represents the lifetime of the &str matched
against.
Methods
impl<'t> Match<'t>[src]
impl<'t> Match<'t>pub fn as_str(&self) -> &'t str[src]
pub fn as_str(&self) -> &'t strReturns the matched text.
pub fn start(&self) -> usize[src]
pub fn start(&self) -> usizeReturns the starting offset of the match.
pub fn end(&self) -> usize[src]
pub fn end(&self) -> usizeReturns the ending offset of the match.
pub fn rule(&self) -> &str[src]
pub fn rule(&self) -> &strReturns the grammar rule matched.
pub fn children(&self) -> Option<&[Match<'t>]>[src]
pub fn children(&self) -> Option<&[Match<'t>]>Returns the sub-matches of this match, if any.
pub fn name(&self, name: &str) -> Option<&Match>[src]
pub fn name(&self, name: &str) -> Option<&Match>Returns the first Match defined by the given rule under this parse
node searching recursively, depth-first, left-to-right.
pub fn all_names(&self, name: &str) -> Vec<&Match>[src]
pub fn all_names(&self, name: &str) -> Vec<&Match>Returns all Matches matching the given rule in the parse tree under
this node. Matches are ordered as found by a depth-first left-to-right
search of the parse tree.