pub enum TokenKind {
Show 50 variants
IntLit(i64),
FloatLit(f64),
BoolLit(bool),
Ident,
Keyword(Keyword),
LParen,
RParen,
LBrace,
RBrace,
LBracket,
RBracket,
Semi,
Comma,
Dot,
Question,
Colon,
Plus,
Minus,
Star,
Slash,
Percent,
Eq,
EqEq,
BangEq,
Lt,
LtEq,
Gt,
GtEq,
PlusEq,
MinusEq,
StarEq,
SlashEq,
PercentEq,
Amp,
AmpAmp,
Bar,
BarBar,
Caret,
Tilde,
Bang,
AmpEq,
BarEq,
CaretEq,
Shl,
Shr,
ShlEq,
ShrEq,
PlusPlus,
MinusMinus,
Eof,
}Expand description
Token kinds produced by tokenize. Identifiers and keywords are
distinguished here so the parser doesn’t have to re-lookup the table for
every ident. Literal values are pre-parsed into i64 / f64 so the
parser doesn’t have to re-parse the lexeme either.
Variants§
IntLit(i64)
Integer literal — value pre-parsed. HLSL accepts decimal (12,
leading-zero like 02) and hex (0x1F); we widen to i64. The u
suffix (12u) is recognised but doesn’t change the storage type
here — emitters decide.
FloatLit(f64)
Float literal — value pre-parsed. HLSL accepts 1.5, .5, 5.,
1e2, 1.5e-3, optional f / h suffix.
BoolLit(bool)
Boolean literal (true / false). HLSL uses lowercase only.
Ident
Generic identifier — type names like float2, mat3x3, sampler
names, user variables, builtins. The parser context tells us which
kind we have.
Keyword(Keyword)
if, else, while, for, do, return, break, continue,
static, const, in, out, inout, struct, sampler,
void. The variant carries the keyword identity.
LParen
RParen
LBrace
RBrace
LBracket
RBracket
Semi
Comma
Dot
Question
Colon
Plus
Minus
Star
Slash
Percent
Eq
EqEq
BangEq
Lt
LtEq
Gt
GtEq
PlusEq
MinusEq
StarEq
SlashEq
PercentEq
Amp
AmpAmp
Bar
BarBar
Caret
Tilde
Bang
AmpEq
BarEq
CaretEq
Shl
Shr
ShlEq
ShrEq
PlusPlus
MinusMinus
Eof
End of input. Always the last token; the parser uses it to know it has consumed everything.