From e0210a8f09f1ec07bf3fef3606fc717e21d0eeaa Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 1 Apr 2023 16:43:33 -0700 Subject: [PATCH] Cleanup --- src/parser/tokenize.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/parser/tokenize.rs b/src/parser/tokenize.rs index 71ba6e9..037c37e 100644 --- a/src/parser/tokenize.rs +++ b/src/parser/tokenize.rs @@ -49,16 +49,6 @@ pub(in crate::parser) fn tokenize(input: &String) -> VecDeque { for (i, c) in input.chars().enumerate() { match c { - // The minus sign can be both a Negative and an Operator. - // Needs special treatment. - '-' => { - push_token(&mut g, t, i); - t = Some(PreToken::PreOperator( - LineLocation{pos: i, len: 1}, - String::from("-") - )); - }, - // Number // Commas act just like dots. ',' | '.' | '0'..='9' => { @@ -78,6 +68,16 @@ pub(in crate::parser) fn tokenize(input: &String) -> VecDeque { }; }, + // The minus sign can be both a Negative and an Operator. + // Needs special treatment, always starts a new token. + '-' => { + push_token(&mut g, t, i); + t = Some(PreToken::PreOperator( + LineLocation{pos: i, len: 1}, + String::from("-") + )); + }, + // Operator '*'|'×'|'/'|'÷'| '+'|'^'|'!'|'%'