From cb91fa52def53b9d510cbdd089e5f1edf291e0b6 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sun, 1 Oct 2023 18:43:04 +0200 Subject: [PATCH] lexer: change num type to i64 --- src/lexer.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index e4be7b2..142725c 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -5,7 +5,7 @@ pub enum LadderTypeToken { Symbol( String ), Char( char ), - Num( u64 ), + Num( i64 ), Open, Close, Ladder, @@ -26,7 +26,7 @@ pub enum LexError { enum LexerState { Any, Sym( String ), - Num( u64 ), + Num( i64 ), Char( Option ) } @@ -124,7 +124,7 @@ where It: Iterator LexerState::Num(n) => { if let Some(d) = c.to_digit(10) { - *n = (*n) * 10 + d as u64; + *n = (*n) * 10 + d as i64; } else { return Some(Err(LexError::InvalidDigit)); }