1use crate::interner::InternedStr;
2use crate::span::SpanId;
3
4#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
5pub struct Token<'p, 'ast> {
6 pub span: SpanId,
7 pub kind: TokenKind<'p, 'ast>,
8}
9
10#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
11pub enum TokenKind<'p, 'ast> {
12 EndOfFile,
13 Whitespace,
14 Comment,
15
16 Simple(STokenKind),
17 OtherOp(&'ast str),
18 Ident(InternedStr<'p>),
19 Number(Number<'ast>),
20 String(&'ast str),
21 TextBlock(&'ast str),
22}
23
24#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
25pub enum STokenKind {
26 Assert,
28 Else,
29 Error,
30 False,
31 For,
32 Function,
33 If,
34 Import,
35 Importstr,
36 Importbin,
37 In,
38 Local,
39 Null,
40 Tailstrict,
41 Then,
42 Self_,
43 Super,
44 True,
45
46 Exclam,
48 ExclamEq,
49 Dollar,
50 Percent,
51 Amp,
52 AmpAmp,
53 LeftParen,
54 RightParen,
55 Asterisk,
56 Plus,
57 PlusColon,
58 PlusColonColon,
59 PlusColonColonColon,
60 Comma,
61 Minus,
62 Dot,
63 Slash,
64 Colon,
65 ColonColon,
66 ColonColonColon,
67 Semicolon,
68 Lt,
69 LtLt,
70 LtEq,
71 Eq,
72 EqEq,
73 Gt,
74 GtEq,
75 GtGt,
76 LeftBracket,
77 RightBracket,
78 Hat,
79 LeftBrace,
80 Pipe,
81 PipePipe,
82 RightBrace,
83 Tilde,
84}
85
86#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
87pub struct Number<'ast> {
88 pub digits: &'ast str,
89 pub exp: i64,
90}