luthor/token.rs
1//! Token-related types.
2
3/// The primary means of classifying a format or language's lexemes.
4#[derive(PartialEq, Debug, Clone)]
5pub enum Category {
6 Whitespace,
7 Identifier,
8 Keyword,
9 Brace,
10 Bracket,
11 Parenthesis,
12 Operator,
13 Integer,
14 Float,
15 String,
16 Boolean,
17 Text,
18 Comment,
19 Function,
20 Method,
21 Call,
22 Literal,
23 Key,
24}
25
26/// A lexeme and category pairing. Tokens are the final product of a lexer;
27/// their lexemes should join to produce the original data passed to the lexer.
28#[derive(PartialEq, Debug, Clone)]
29pub struct Token {
30 pub lexeme: String,
31 pub category: Category,
32}