refactor(lexer): rename value type tokens for v0.3

Renamed lexer tokens to align with new v0.3 naming convention:
- IntLit -> NumberLit
- FloatLit -> DecimalLit
- StringLit -> TextLit

Updated all references across parser grammar, property tests,
and editor highlighting.
This commit is contained in:
2026-02-14 13:58:46 +00:00
parent 4e4e5500b0
commit 8c3c380cfd
6 changed files with 68 additions and 68 deletions

View File

@@ -130,16 +130,16 @@ pub enum Token {
Ident(String),
#[regex(r"-?[0-9]+", |lex| lex.slice().parse::<i64>().ok())]
IntLit(i64),
NumberLit(i64),
#[regex(r"-?[0-9]+\.[0-9]+", |lex| lex.slice().parse::<f64>().ok())]
FloatLit(f64),
DecimalLit(f64),
#[regex(r#""([^"\\]|\\.)*""#, |lex| {
let s = lex.slice();
s[1..s.len()-1].to_string()
})]
StringLit(String),
TextLit(String),
// Time literal: HH:MM or HH:MM:SS
#[regex(r"[0-9]{2}:[0-9]{2}(:[0-9]{2})?", |lex| lex.slice().to_string())]
@@ -208,9 +208,9 @@ impl fmt::Display for Token {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
| Token::Ident(s) => write!(f, "identifier '{}'", s),
| Token::IntLit(n) => write!(f, "integer {}", n),
| Token::FloatLit(n) => write!(f, "float {}", n),
| Token::StringLit(s) => write!(f, "string \"{}\"", s),
| Token::NumberLit(n) => write!(f, "number {}", n),
| Token::DecimalLit(n) => write!(f, "decimal {}", n),
| Token::TextLit(s) => write!(f, "text \"{}\"", s),
| Token::TimeLit(s) => write!(f, "time {}", s),
| Token::DurationLit(s) => write!(f, "duration {}", s),
| Token::ProseBlock(pb) => write!(f, "prose block ---{}", pb.tag),
@@ -404,7 +404,7 @@ mod tests {
Token::LBrace,
Token::Ident("age".to_string()),
Token::Colon,
Token::IntLit(34),
Token::NumberLit(34),
Token::RBrace,
]
);
@@ -512,7 +512,7 @@ Second prose block content.
assert_eq!(
tokens,
vec![Token::IntLit(20), Token::DotDot, Token::IntLit(40),]
vec![Token::NumberLit(20), Token::DotDot, Token::NumberLit(40),]
);
}