pub enum DatumKind<'a> {
List {
delim: Delim,
items: Vec<Datum<'a>>,
tail: Option<Box<Datum<'a>>>,
dot: Option<Span>,
},
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>>,
arg: Option<Box<Datum<'a>>>,
},
HashLiteral {
tag: &'a str,
inner: Option<Box<Datum<'a>>>,
},
Label {
id: &'a str,
inner: Box<Datum<'a>>,
},
LabelRef {
id: &'a str,
},
}Expand description
The shape of a Datum.
Variants§
List
A list. tail: Some(_) marks an improper/dotted list (a b . c)
(ADR-0009). The delimiter is shape only; its meaning is the consumer’s
per dialect.
Fields
dot: Option<Span>Byte span of the . separator, present only for an improper list.
A text-based reindenter needs the dot’s column to align a tail
continuation under it (the '(eval . FORM) font-lock idiom), which
tail alone can’t give (ADR-0009). Some iff tail is Some; see
Datum::dot_span.
Symbol(&'a str)
A symbol; verbatim slice, including enclosing |bars| if piped.
The Symbol/Number split is lexical-shape only,
following Scheme-ish rules; the classifier never interprets a value.
Anything ambiguous falls back to Symbol — e.g. Common Lisp’s 1+ and
1- are conventionally functions, not numbers, so a leading digit
alone is not sufficient. Consumers that need a stricter or
dialect-specific numeric grammar reclassify Symbol/Number text
themselves; lispexp only records the token’s shape.
Keyword(&'a str)
A keyword such as :foo or #:foo.
Number(&'a str)
A number; raw text, value never interpreted.
Classification is lexical-shape only (see Symbol):
digits, sign, radix/exactness prefixes (#x, #e, #36r...), decimal
points, ratios, exponent markers, and a trailing complex i all
qualify. Clojure’s symbolic values (##Inf, ##-Inf, ##NaN)
classify as Number in every dialect, since they are read as numeric
literals regardless of whether the dialect otherwise supports them.
Str(&'a str)
A string; raw slice including the surrounding quotes and escapes.
Char(&'a str)
A character literal; raw slice including the #\ / ? / \ lead form.
Bool(bool)
A boolean.
Prefixed
A reader macro applied to an inner datum (ADR-0002). notation
distinguishes 'x (shorthand) from (quote x) (longhand).
Fields
arg: Option<Box<Datum<'a>>>The auxiliary datum some prefixes carry, if any: the metadata form
for Prefix::Meta (^meta target: arg is the metadata,
inner the target) and the feature test for
Prefix::FeatureConditional (#+sbcl form: arg is sbcl,
inner the guarded form). None for every other prefix. The
enclosing span covers glyph, arg, and inner.
HashLiteral
Any #tag-shaped form; tag is captured verbatim and unvalidated
(ADR-0011). E.g. "" for #(...), "u8" for #u8(...). The tag may
contain reader-macro glyphs — #`(…) (a Scheme syntax-case
template) reads as a HashLiteral with tag "`", and #,(…) with
tag "," — because a #tag immediately followed by an opening
delimiter is always this one form. A #tag not followed by a
delimiter (e.g. #`x) is instead a DatumKind::Symbol.
Fields
Label
A datum label definition #n=<datum> (ADR-0011). No graph resolution.
Fields
LabelRef
A datum label reference #n#.