Convert int values to i64 in accordance with spec
This commit is contained in:
parent
cd93c1a3bd
commit
8d856d0651
2 changed files with 3 additions and 3 deletions
|
@ -4,17 +4,17 @@ use std::fmt;
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum Expression<'source> {
|
pub enum Expression<'source> {
|
||||||
EmptyLiteral(CodeLocation),
|
EmptyLiteral(CodeLocation),
|
||||||
IntLiteral(CodeLocation, u32),
|
IntLiteral(CodeLocation, i64),
|
||||||
BoolLiteral(CodeLocation, bool),
|
BoolLiteral(CodeLocation, bool),
|
||||||
Identifier(CodeLocation, &'source str),
|
Identifier(CodeLocation, &'source str),
|
||||||
UnaryOp(CodeLocation, &'source str, Box<Expression<'source>>),
|
UnaryOp(CodeLocation, &'source str, Box<Expression<'source>>),
|
||||||
VarDeclaration(CodeLocation, &'source str, Box<Expression<'source>>),
|
|
||||||
BinaryOp(
|
BinaryOp(
|
||||||
CodeLocation,
|
CodeLocation,
|
||||||
Box<Expression<'source>>,
|
Box<Expression<'source>>,
|
||||||
&'source str,
|
&'source str,
|
||||||
Box<Expression<'source>>,
|
Box<Expression<'source>>,
|
||||||
),
|
),
|
||||||
|
VarDeclaration(CodeLocation, &'source str, Box<Expression<'source>>),
|
||||||
Conditional(
|
Conditional(
|
||||||
CodeLocation,
|
CodeLocation,
|
||||||
Box<Expression<'source>>,
|
Box<Expression<'source>>,
|
||||||
|
|
|
@ -260,7 +260,7 @@ fn parse_int_literal<'source>(pos: &mut usize, tokens: &[Token]) -> Expression<'
|
||||||
token.loc,
|
token.loc,
|
||||||
token
|
token
|
||||||
.text
|
.text
|
||||||
.parse::<u32>()
|
.parse::<i64>()
|
||||||
.unwrap_or_else(|_| panic!("Fatal parser error! Invalid value in token {token}")),
|
.unwrap_or_else(|_| panic!("Fatal parser error! Invalid value in token {token}")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue