aboutsummaryrefslogtreecommitdiff
path: root/src/lex/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lex/mod.rs')
-rw-r--r--src/lex/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lex/mod.rs b/src/lex/mod.rs
index cac16ca..caafd4b 100644
--- a/src/lex/mod.rs
+++ b/src/lex/mod.rs
@@ -122,7 +122,7 @@ fn factorial (n: f64) -> f64 {
122 n.signum() * (1.. n.abs() as u64 +1).fold(1, |p, n| p*n) as f64 122 n.signum() * (1.. n.abs() as u64 +1).fold(1, |p, n| p*n) as f64
123} 123}
124 124
125pub fn lexer(input: &str, prev_ans: &mut f64) -> Result<Vec<Token>, CalcError> { 125pub fn lexer(input: &str, prev_ans: f64) -> Result<Vec<Token>, CalcError> {
126 let functions: HashMap<&str, Token> = get_functions(); 126 let functions: HashMap<&str, Token> = get_functions();
127 let operators: HashMap<char, Token> = get_operators(); 127 let operators: HashMap<char, Token> = get_operators();
128 128
@@ -159,7 +159,7 @@ pub fn lexer(input: &str, prev_ans: &mut f64) -> Result<Vec<Token>, CalcError> {
159 num_vec.clear(); 159 num_vec.clear();
160 } 160 }
161 last_char_is_op = false; 161 last_char_is_op = false;
162 result.push(Token::Num(*prev_ans)); 162 result.push(Token::Num(prev_ans));
163 } 163 }
164 'a'...'z' | 'A'...'Z' => { 164 'a'...'z' | 'A'...'Z' => {
165 let parse_num = num_vec.parse::<f64>().ok(); 165 let parse_num = num_vec.parse::<f64>().ok();