From b71cbcafcd5b76821faed8d89f6056e630d707fc Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 26 Mar 2023 09:54:25 -0700 Subject: [PATCH] Fixed negative bug --- src/parser/tokenize.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/parser/tokenize.rs b/src/parser/tokenize.rs index 7a2bd5c..0b51df9 100644 --- a/src/parser/tokenize.rs +++ b/src/parser/tokenize.rs @@ -38,12 +38,12 @@ pub fn p_tokenize(input: &String) -> VecDeque { // Needs special treatment. '-' => { if t.is_some() { g.push_back(update_line_location(t.unwrap(), i)); } - match g.back() { + match g.back().as_ref().unwrap() { // If previous token was any of the following, // this is the "minus" operator - Some(Token::Number(_, _)) | - Some(Token::PreGroup(_, _)) | - Some(Token::PreWord(_, _)) => { + Token::PreNumber(_, _) | + Token::PreGroup(_, _) | + Token::PreWord(_, _) => { t = Some(Token::PreOperator( LineLocation{pos: i, len: 1}, Operator::Subtract @@ -118,8 +118,6 @@ pub fn p_tokenize(input: &String) -> VecDeque { } // Word - //'A'..='Z' | - //'a'..='z' _ => { match &mut t { Some(Token::PreWord(_, val)) => {