Reference: literals
Reference: literals
Section titled “Reference: literals”Normative lexer: crates/vox-compiler/src/lexer/token.rs (#[regex(...)] on Token).
Source encoding
Section titled “Source encoding”- Vox source files are interpreted as UTF-8 text (Rust
str), consistent with thestrprimitive in syntax.
Integers
Section titled “Integers”- Pattern: ASCII digits
[0-9]+, parsed asi64(Token::IntLit). - No
0x/0o/ binary integer literals are defined in the current lexer.
Floating-point
Section titled “Floating-point”- Pattern:
[0-9]+.[0-9]+optionally suffixed withdecfor fixed-precision literals (Token::FloatLitvsToken::DecLit). - See lexer comments in
token.rsfor the exact regex split betweenFloatLitandDecLit.
Strings
Section titled “Strings”- Double-quoted (
"…"):Token::StringLitwith escapes:\n,\t,\r,\\,\",\',\0; unknown escapes preserve\+ char. - Single-quoted (
'…'):Token::SingleStringLitwith the same escape set.
Booleans and keywords
Section titled “Booleans and keywords”true/falseare keywords, not numeric literals.