Skip to content

Reference: literals

Normative lexer: crates/vox-compiler/src/lexer/token.rs (#[regex(...)] on Token).

  • Vox source files are interpreted as UTF-8 text (Rust str), consistent with the str primitive in syntax.
  • Pattern: ASCII digits [0-9]+, parsed as i64 (Token::IntLit).
  • No 0x / 0o / binary integer literals are defined in the current lexer.
  • Pattern: [0-9]+.[0-9]+ optionally suffixed with dec for fixed-precision literals (Token::FloatLit vs Token::DecLit).
  • See lexer comments in token.rs for the exact regex split between FloatLit and DecLit.
  • Double-quoted ("…"): Token::StringLit with escapes: \n, \t, \r, \\, \", \', \0; unknown escapes preserve \ + char.
  • Single-quoted ('…'): Token::SingleStringLit with the same escape set.
  • true / false are keywords, not numeric literals.