number types

This commit is contained in:
me 2025-12-19 13:13:28 +02:00
parent c51a7fd0fc
commit eafed4f9ed
3 changed files with 8 additions and 8 deletions

View file

@ -62,8 +62,8 @@ pub struct Definition {
/// A reduced value.
#[derive(PartialEq, PartialOrd, Debug, Clone)]
pub enum Value {
Int(i64),
Float(f64),
Int(i32),
Float(f32),
String(String),
Boolean(bool),
Record(Record),
@ -159,14 +159,14 @@ impl Expr {
}
}
impl From<i64> for Value {
fn from(i: i64) -> Value {
impl From<i32> for Value {
fn from(i: i32) -> Value {
Value::Int(i)
}
}
impl From<i64> for Expr {
fn from(i: i64) -> Expr {
impl From<i32> for Expr {
fn from(i: i32) -> Expr {
Expr::Value(i.into())
}
}

View file

@ -165,7 +165,7 @@ pub fn scan(source: String) -> Tokens {
break;
}
}
let i = str.parse::<u32>().unwrap();
let i = str.parse::<u16>().unwrap();
tokens.push(LocatedToken {
start,
end: scanner.cursor(),

View file

@ -34,7 +34,7 @@ pub enum Token {
Colon,
True,
False,
Number(u32),
Number(u16),
String(String),
Identifier(String),
Label(String),