diff options
author | NerdyPepper <[email protected]> | 2019-03-19 16:34:15 +0000 |
---|---|---|
committer | NerdyPepper <[email protected]> | 2019-03-19 16:34:15 +0000 |
commit | 770bef9bdbc6185ba08d2881f0cf7b98f68af95d (patch) | |
tree | 57eda7e4d2e0e216be1543bd891c7943ba34721c /src/main.rs | |
parent | 7375d87ea553bc318b224909544dbda470de73ca (diff) |
fix lexing issue (drain num_vec)
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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<Vec<Token>, String> { | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
94 | let parse_num = num_vec.parse::<f64>().ok(); | ||
95 | if let Some(x) = parse_num { | ||
96 | result.push(Token::Num(x)); | ||
97 | num_vec.clear(); | ||
98 | } | ||
94 | Ok(result) | 99 | Ok(result) |
95 | } | 100 | } |
96 | 101 | ||