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 '*'|'×'|'/'|'÷'| '+'|'^'|'!'|'%'