use logos::Logos;
#[derive(Logos, Debug, PartialEq, Clone)]
#[logos(skip r"[ \t]+")]
#[logos(skip r"#[^\n]*")]
pub enum Token {
#[token("and")]
And,
#[token("as")]
As,
#[token("assert")]
Assert,
#[token("async")]
Async,
#[token("await")]
Await,
#[token("break")]
Break,
#[token("class")]
Class,
#[token("continue")]
Continue,
#[token("def")]
Def,
#[token("del")]
Del,
#[token("elif")]
Elif,
#[token("else")]
Else,
#[token("except")]
Except,
#[token("False")]
False,
#[token("finally")]
Finally,
#[token("for")]
For,
#[token("from")]
From,
#[token("global")]
Global,
#[token("if")]
If,
#[token("import")]
Import,
#[token("in")]
In,
#[token("is")]
Is,
#[token("lambda")]
Lambda,
#[token("let")]
Let,
#[token("match")]
Match,
#[token("case")]
Case,
#[token("None")]
None,
#[token("nonlocal")]
Nonlocal,
#[token("not")]
Not,
#[token("or")]
Or,
#[token("pass")]
Pass,
#[token("raise")]
Raise,
#[token("return")]
Return,
#[token("True")]
True,
#[token("try")]
Try,
#[token("while")]
While,
#[token("with")]
With,
#[token("yield")]
Yield,
#[regex(r"-?[0-9]+")]
Int,
#[regex(r"-?[0-9]+\.[0-9]+")]
Float,
#[regex(r#""([^"\\]|\\.)*""#)]
#[regex(r#"'([^'\\]|\\.)*'"#)]
String,
#[regex(r#"f"([^"\\]|\\.)*""#)]
#[regex(r#"f'([^'\\]|\\.)*'"#)]
FString,
#[regex(r"[a-zA-Z_][a-zA-Z0-9_]*")]
Identifier,
#[token("+")]
Plus,
#[token("-")]
Minus,
#[token("*")]
Star,
#[token("**")]
StarStar,
#[token("/")]
Slash,
#[token("//")]
SlashSlash,
#[token("%")]
Percent,
#[token("@")]
At,
#[token("<<")]
LeftShift,
#[token(">>")]
RightShift,
#[token("&")]
Ampersand,
#[token("|")]
Pipe,
#[token("^")]
Caret,
#[token("~")]
Tilde,
#[token("<")]
Less,
#[token(">")]
Greater,
#[token("<=")]
LessEqual,
#[token(">=")]
GreaterEqual,
#[token("==")]
EqualEqual,
#[token("!=")]
NotEqual,
#[token("(")]
LeftParen,
#[token(")")]
RightParen,
#[token("[")]
LeftBracket,
#[token("]")]
RightBracket,
#[token("{")]
LeftBrace,
#[token("}")]
RightBrace,
#[token(",")]
Comma,
#[token(":")]
Colon,
#[token(".")]
Dot,
#[token(";")]
Semicolon,
#[token("=")]
Equal,
#[token("->")]
Arrow,
#[token("\n")]
Newline,
Indent,
Dedent,
}
impl Token {
pub fn is_trivia(&self) -> bool {
false }
}