summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src/token.rs
blob: 3147899d64a13d8332a98820c1aa43ef1239822b (plain)
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
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Token<'a> {
	Ident(Ident<'a>),
	Punct(Punct),
	Literal(Literal<'a>),
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Ident<'a>(pub &'a str);

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Punct(pub char, pub Spacing);

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Spacing {
	Alone,
	Joint,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Literal<'a> {
	pub content: &'a str,
	pub kind: LiteralKind,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LiteralKind {
	Number,
	String,
	RawString,
	ScriptString,
}