Trait LexingRule

Source
pub trait LexingRule {
    // Required method
    fn lex(&self, text: &str, state: &mut LexState) -> usize;
}
Expand description

This trait is used by the crate::parser::lex_next_token function and is implemented for rule passed to the macro which can be either a string literal, or a function

Required Methods§

Source

fn lex(&self, text: &str, state: &mut LexState) -> usize

Return the size of the match for this rule, or 0 if there is no match

Implementations on Foreign Types§

Source§

impl<'a> LexingRule for &'a str

Source§

fn lex(&self, text: &str, _: &mut LexState) -> usize

Implementors§

Source§

impl<F: Fn(&str, &mut LexState) -> usize> LexingRule for F