use crate::span::Span;
#[derive(Debug, Clone, PartialEq)]
pub struct Datum<'a> {
pub kind: DatumKind<'a>,
pub span: Span,
pub line: u32,
}
#[derive(Debug, Clone, PartialEq)]
pub enum DatumKind<'a> {
List {
delim: Delim,
items: Vec<Datum<'a>>,
tail: Option<Box<Datum<'a>>>,
},
Symbol(&'a str),
Keyword(&'a str),
Number(&'a str),
Str(&'a str),
Char(&'a str),
Bool(bool),
Prefixed {
prefix: Prefix,
notation: Notation,
inner: Box<Datum<'a>>,
},
HashLiteral {
tag: &'a str,
inner: Option<Box<Datum<'a>>>,
},
Label {
id: &'a str,
inner: Box<Datum<'a>>,
},
LabelRef {
id: &'a str,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Delim {
Round,
Square,
Curly,
Set,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Prefix {
Quote,
Quasiquote,
Unquote,
UnquoteSplicing,
Discard,
VarQuote,
FunctionQuote,
Deref,
Meta,
ReadEval,
ReaderConditional(bool),
HashFn,
Splice,
Mutable,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Notation {
Shorthand,
Longhand,
}