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

#[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,
}