From 770bef9bdbc6185ba08d2881f0cf7b98f68af95d Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Tue, 19 Mar 2019 22:04:15 +0530 Subject: fix lexing issue (drain num_vec) --- src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index d9f6b01..66faaee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,6 +91,11 @@ fn lexer(input: &str) -> Result, String> { } } } + let parse_num = num_vec.parse::().ok(); + if let Some(x) = parse_num { + result.push(Token::Num(x)); + num_vec.clear(); + } Ok(result) } -- cgit v1.2.3