pub enum Token {
Symbol(String),
TypedSymbol {
name: String,
kind: String,
},
Bareword(String),
Timestamp(String),
Integer(i64),
Float(f64),
String(String),
Boolean(bool),
Nil,
Keyword(String),
LParen,
RParen,
}Expand description
A lexical token.
Matches the token classes in ir-write-surface.md § 3.1. String-
bearing variants own their content (copying out of the input); this
trades a small allocation per token for simpler parser lifetimes.
Variants§
Symbol(String)
@name — a symbol reference. Leading @ stripped.
TypedSymbol
@name:Kind — a symbol reference with a kind annotation. The
Kind string is passed through for later validation in the
parser / binder.
Fields
Bareword(String)
A bareword identifier — matches [a-z_][a-z0-9_]*. Serves as
opcode at form heads, predicate in predicate slots, string
literal elsewhere (disambiguation is the parser’s job).
Timestamp(String)
An ISO-8601-UTC timestamp bareword (date-only or full date-time
with optional millisecond fraction and a Z suffix).
Integer(i64)
A signed 64-bit integer literal.
Float(f64)
An IEEE 754 binary64 float literal (contains a .).
String(String)
A double-quoted UTF-8 string with escape sequences resolved.
Boolean(bool)
Boolean literal true or false.
Nil
nil null literal.
Keyword(String)
:keyword — keyword argument tag, without the leading :.
LParen
Open parenthesis (.
RParen
Close parenthesis ).