Struct pest::Token
[−]
[src]
pub struct Token<Rule> { pub rule: Rule, pub start: usize, pub end: usize, }
A struct
representing tokens generated by a parser.
Fields
rule: Rule
matched Rule
start: usize
starting position in Input
end: usize
ending position in Input
Methods
impl<Rule> Token<Rule>
[src]
fn new(rule: Rule, start: usize, end: usize) -> Token<Rule>
Creates a new Token
.
Examples
impl_rdp! { grammar! { expression = _{ paren ~ expression? } paren = { ["("] ~ expression? ~ [")"] } } } let token = Token::new(Rule::paren, 0, 1); assert_eq!(token.rule, Rule::paren); assert_eq!(token.start, 0); assert_eq!(token.end, 1);
Trait Implementations
impl<Rule: Clone> Clone for Token<Rule>
[src]
fn clone(&self) -> Token<Rule>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<Rule: Copy> Copy for Token<Rule>
[src]
impl<Rule: Debug> Debug for Token<Rule>
[src]
impl<Rule: Eq> Eq for Token<Rule>
[src]
impl<Rule: Hash> Hash for Token<Rule>
[src]
fn hash<__HRule: Hasher>(&self, __arg_0: &mut __HRule)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.