diff options
Diffstat (limited to 'src/lex.rs')
-rw-r--r-- | src/lex.rs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -143,6 +143,12 @@ pub fn lexer(input: &str, prev_ans: Option<f64>) -> Result<Vec<Token>, CalcError | |||
143 | &char_vec[..char_vec.chars().count()-1] | 143 | &char_vec[..char_vec.chars().count()-1] |
144 | ))); | 144 | ))); |
145 | } | 145 | } |
146 | } else if CONSTANTS.get(&char_vec[..]).is_some() { | ||
147 | result.push(CONSTANTS.get(&char_vec[..]).unwrap().clone()); | ||
148 | result.push(OPERATORS.get(&'*').unwrap().clone()); | ||
149 | char_vec.clear(); | ||
150 | num_vec.push(letter); | ||
151 | last_char_is_op = false; | ||
146 | } else { | 152 | } else { |
147 | return Err(CalcError::Syntax(format!( | 153 | return Err(CalcError::Syntax(format!( |
148 | "Unexpected character '{}'", | 154 | "Unexpected character '{}'", |