summaryrefslogtreecommitdiffstats
path: root/crates/rebel-parse/src/token.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel-parse/src/token.rs')
-rw-r--r--crates/rebel-parse/src/token.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/rebel-parse/src/token.rs b/crates/rebel-parse/src/token.rs
new file mode 100644
index 0000000..3147899
--- /dev/null
+++ b/crates/rebel-parse/src/token.rs
@@ -0,0 +1,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,
+}