ableos/dev/src/idl/mod.rs

21 lines
420 B
Rust
Raw Normal View History

2024-08-30 07:38:04 -05:00
use logos::Logos;
#[derive(Logos, Debug, PartialEq)]
#[logos(skip r"[ \t\n\f]+")] // Ignore this regex pattern between tokens
enum Token {
// Tokens can be literal strings, of any length.
#[token("protocol")]
Protocol,
#[token(".")]
Period,
// Or regular expressions.
#[regex("[a-zA-Z]+")]
Text,
}
pub fn main() {
let mut lex = Token::lexer("Create ridiculously fast Lexers.");
}