1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/// A single lexical token produced by the clojurust lexer.
#[derive(Debug, Clone, PartialEq)]
pub enum Token {
// ── Atoms ────────────────────────────────────────────────────────────────
/// The literal `nil`.
Nil,
/// `true` or `false`.
Bool(bool),
/// Decimal or radix integer that fits in `i64`.
Int(i64),
/// `N`-suffix integer or one that overflows `i64`; stores decimal digits
/// without any sign or suffix (sign is implicit via the original `-`).
BigInt(String),
/// IEEE-754 double.
Float(f64),
/// `M`-suffix decimal; stores the raw text without the trailing `M`.
BigDecimal(String),
/// Rational literal `3/4`; stores the full text including the slash.
Ratio(String),
/// Character literal `\a`, `\newline`, `\u0041`, …
Char(char),
/// String literal with escape sequences fully processed.
Str(String),
// ── Identifiers ──────────────────────────────────────────────────────────
/// A symbol: `foo`, `ns/name`, `/`, `..`
Symbol(String),
/// A keyword (`:foo`); the leading colon is stripped, so stores `"foo"`.
Keyword(String),
/// An auto-resolved keyword (`::foo`); stores `"foo"` (leading `::` stripped).
AutoKeyword(String),
// ── Delimiters ───────────────────────────────────────────────────────────
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
// ── Reader macros ────────────────────────────────────────────────────────
/// `'`
Quote,
/// `` ` ``
SyntaxQuote,
/// `~`
Unquote,
/// `~@`
UnquoteSplice,
/// `@`
Deref,
/// `^`
Meta,
// ── `#` dispatch ─────────────────────────────────────────────────────────
/// `#(`
HashFn,
/// `#{`
HashSet,
/// `#'`
HashVar,
/// `#_`
HashDiscard,
/// `#"…"` — raw regex pattern, no escape processing.
Regex(String),
/// `#?`
ReaderCond,
/// `#?@`
ReaderCondSplice,
/// `##Inf` / `##-Inf` / `##NaN`; stores the suffix after `##`.
Symbolic(String),
/// `#tag` — tagged literal; stores the symbol name without the leading `#`.
TaggedLiteral(String),
/// The validated `#:ns` / `#::` / `#::alias` prefix of a namespaced map
/// literal. The following `{` is lexed as an ordinary `LBrace`.
NamespacedMap(crate::namespaced_map::MapNs),
/// End-of-file sentinel.
Eof,
}