1
0
Fork 0

Convert int values to i64 in accordance with spec

This commit is contained in:
Vili Sinervä 2025-02-03 16:34:15 +02:00
parent cd93c1a3bd
commit 8d856d0651
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
2 changed files with 3 additions and 3 deletions

View file

@ -4,17 +4,17 @@ use std::fmt;
#[derive(Debug, PartialEq)]
pub enum Expression<'source> {
EmptyLiteral(CodeLocation),
IntLiteral(CodeLocation, u32),
IntLiteral(CodeLocation, i64),
BoolLiteral(CodeLocation, bool),
Identifier(CodeLocation, &'source str),
UnaryOp(CodeLocation, &'source str, Box<Expression<'source>>),
VarDeclaration(CodeLocation, &'source str, Box<Expression<'source>>),
BinaryOp(
CodeLocation,
Box<Expression<'source>>,
&'source str,
Box<Expression<'source>>,
),
VarDeclaration(CodeLocation, &'source str, Box<Expression<'source>>),
Conditional(
CodeLocation,
Box<Expression<'source>>,

View file

@ -260,7 +260,7 @@ fn parse_int_literal<'source>(pos: &mut usize, tokens: &[Token]) -> Expression<'
token.loc,
token
.text
.parse::<u32>()
.parse::<i64>()
.unwrap_or_else(|_| panic!("Fatal parser error! Invalid value in token {token}")),
)
}