From 9dceeaf114b17608ff0c3f91712ea60eaaaf9d6b Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 13 Oct 2020 15:51:59 +0800 Subject: [PATCH] Reserve ** operator. --- doc/src/appendix/operators.md | 1 + src/token.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc/src/appendix/operators.md b/doc/src/appendix/operators.md index 7f20f003..ff9b7fed 100644 --- a/doc/src/appendix/operators.md +++ b/doc/src/appendix/operators.md @@ -60,6 +60,7 @@ Symbols and Patterns | `--` | decrement | _reserved_ | | `..` | range | _reserved_ | | `...` | range | _reserved_ | +| `**` | exponentiation | _reserved_ | | `#` | hash | _reserved_ | | `@` | at | _reserved_ | | `$` | dollar | _reserved_ | diff --git a/src/token.rs b/src/token.rs index 428067ef..eb2d63f3 100644 --- a/src/token.rs +++ b/src/token.rs @@ -1231,6 +1231,10 @@ fn get_next_token_inner( ('-', _) if !state.non_unary => return Some((Token::UnaryMinus, start_pos)), ('-', _) => return Some((Token::Minus, start_pos)), + ('*', '*') => { + eat_next(stream, pos); + return Some((Token::Reserved("**".into()), start_pos)); + } ('*', ')') => { eat_next(stream, pos); return Some((Token::Reserved("*)".into()), start_pos));