[][src]Function rslexer::lex

pub fn lex<T>(content: &str, rules: Rules<T>) -> Result<Vec<T>, String>

The main funtion of the lexer

lex expects the content you want to lex as a &str and a Vec of Rulse (use the rules! macro for that)!


enum Token {
    Word(String, usize, usize),
lex("test string \n new line!",
        r"\s+" => |_,_,_| None,
        r"[^\s]+" => |s, l, c| Some(Token::Word(s.to_str(), l, c)),