Skip to main content

lex

Function lex 

Source
pub fn lex(src: &str) -> Result<Vec<Token>, Error>
Expand description

Lex the entire source string into a vector of tokens.

§Errors

Returns Error::UnexpectedChar on any non-ASCII byte or any character outside the grammar.

§Examples

use lambda_cat::lexer::{lex, TokenKind};

let tokens = lex("\\x. x")?;
assert_eq!(tokens.len(), 4);