lex
This library aids in parsing programming languages.
lex = "0.15.0-rc.1"
There are no dependencies.
Lexer
The lexer converts source text into a sequence of tokens using ordered rules. Tokens are generic
over a user-defined TokenKind enum. The lexer is error-free — all input is tokenizable.
use ;
use ;
use literal;
let lexer: = default
.with_rule
.with_rule
.with_rule;
let tokens: = lexer.lex;
Parser
The parser provides a token-stream cursor with skip sets, checkpoints for backtracking, multi-error recovery, and leading comment extraction.
use Parser;
let mut parser: = new
.with_skip;
let token: = parser.expect ?;
Built-in Matchers
ident—[a-zA-Z_][a-zA-Z0-9_]*digits—[0-9]+whitespace— ASCII whitespaceliteral!("...")— exact string matchline_comment!("//")— line comment with delimiter