diff --git a/core/src/scanner.rs b/core/src/scanner.rs index 6d9a45c..2373216 100644 --- a/core/src/scanner.rs +++ b/core/src/scanner.rs @@ -41,15 +41,13 @@ pub enum TokenType { ROUND_BRACKET_OPEN, ROUND_BRACKET_CLOSED, SQUARE_BRACKET_OPEN, SQUARE_BRACKET_CLOSED, CURLY_BRACKET_OPEN, CURLY_BRACKET_CLOSED, SAFE_CALL, COMMA, SAFE_SQUARE_BRACKET, SEMICOLON, QUESTION_MARK, - NOT, AND, OR, PLUS, MINUS, STAR, SLASH, FLOOR_DIVISION, - PERCENTUAL, CARET, HASHTAG, COALESCE, DOT, DOUBLE_COLON, TWODOTS, - COLON, THREEDOTS, ARROW, SAFE_DOT, SAFE_DOUBLE_COLON, - BIT_AND, BIT_OR, BIT_XOR, BIT_NOT, LEFT_SHIFT, RIGHT_SHIFT, - - //definition and comparison + DOT, DOUBLE_COLON, TWODOTS, COLON, THREEDOTS, ARROW, SAFE_DOT, + SAFE_DOUBLE_COLON, NOT, BIT_NOT, STAR, SLASH, PERCENTUAL, PERCENTUAL, + PLUS, MINUS, LEFT_SHIFT, RIGHT_SHIFT, SMALLER, SMALLER_EQUAL, + BIGGER, BIGGER_EQUAL, EQUAL, NOT_EQUAL, BIT_AND, BIT_XOR, BIT_OR, + AND, OR, FLOOR_DIVISION, CARET, HASHTAG, COALESCE, BIT_AND, BIT_XOR, BIT_OR, DEFINE, DEFINE_AND, DEFINE_OR, INCREASE, DECREASE, MULTIPLY, DIVIDE, DEFINE_COALESCE, EXPONENTIATE, CONCATENATE, MODULATE, - BIGGER, BIGGER_EQUAL, SMALLER, SMALLER_EQUAL, EQUAL, NOT_EQUAL, //literals IDENTIFIER, NUMBER, STRING, @@ -91,6 +89,10 @@ impl Token { column, } } + + pub fn is_op(&self) -> bool { + self.kind >= NOT && self.kind <= OR + } } /// A token that has a raw pointer to a [`Token`].