Reserve ** operator.

This commit is contained in:
Stephen Chung 2020-10-13 15:51:59 +08:00
parent 037e8334d4
commit 9dceeaf114
2 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,7 @@ Symbols and Patterns
| `--` | decrement | _reserved_ | | `--` | decrement | _reserved_ |
| `..` | range | _reserved_ | | `..` | range | _reserved_ |
| `...` | range | _reserved_ | | `...` | range | _reserved_ |
| `**` | exponentiation | _reserved_ |
| `#` | hash | _reserved_ | | `#` | hash | _reserved_ |
| `@` | at | _reserved_ | | `@` | at | _reserved_ |
| `$` | dollar | _reserved_ | | `$` | dollar | _reserved_ |

View File

@ -1231,6 +1231,10 @@ fn get_next_token_inner(
('-', _) if !state.non_unary => return Some((Token::UnaryMinus, start_pos)), ('-', _) if !state.non_unary => return Some((Token::UnaryMinus, start_pos)),
('-', _) => return Some((Token::Minus, start_pos)), ('-', _) => return Some((Token::Minus, start_pos)),
('*', '*') => {
eat_next(stream, pos);
return Some((Token::Reserved("**".into()), start_pos));
}
('*', ')') => { ('*', ')') => {
eat_next(stream, pos); eat_next(stream, pos);
return Some((Token::Reserved("*)".into()), start_pos)); return Some((Token::Reserved("*)".into()), start_pos));