Adjust precedence of in.
This commit is contained in:
parent
9dceeaf114
commit
13c4d0bbb3
@ -20,7 +20,7 @@ Breaking changes
|
||||
* New reserved symbols: `++`, `--`, `..`, `...`.
|
||||
* Callback signature for custom syntax implementation function is changed to allow for more flexibility.
|
||||
* Default call stack depth for `debug` builds is reduced to 12 (from 16).
|
||||
* Precedence for `~` and `%` is raised.
|
||||
* Precedence for `~` is raised, while `in` is moved below logic comparison operators.
|
||||
|
||||
New features
|
||||
------------
|
||||
|
@ -84,7 +84,11 @@ Operator Precedence
|
||||
|
||||
All operators in Rhai has a _precedence_ indicating how tightly they bind.
|
||||
|
||||
The following _precedence table_ show the built-in precedence of standard Rhai operators:
|
||||
A higher precedence binds more tightly than a lower precedence, so `*` and `/` binds before `+` and `-` etc.
|
||||
|
||||
When registering a custom operator, the operator's precedence must also be provided.
|
||||
|
||||
The following _precedence table_ shows the built-in precedence of standard Rhai operators:
|
||||
|
||||
| Category | Operators | Precedence (0-255) |
|
||||
| ------------------- | :-------------------------------------------------------------------------------------: | :----------------: |
|
||||
@ -92,15 +96,11 @@ The following _precedence table_ show the built-in precedence of standard Rhai o
|
||||
| Logic and bit masks | <code>\|\|</code>, <code>\|</code>, `^` | 30 |
|
||||
| Logic and bit masks | `&`, `&&` | 60 |
|
||||
| Comparisons | `==`, `!=` | 90 |
|
||||
| Comparisons | `>`, `>=`, `<`, `<=` | 110 |
|
||||
| | `in` | 130 |
|
||||
| | `in` | 110 |
|
||||
| Comparisons | `>`, `>=`, `<`, `<=` | 130 |
|
||||
| Arithmetic | `+`, `-` | 150 |
|
||||
| Arithmetic | `*`, `/`, `%` | 180 |
|
||||
| Arithmetic | `~` | 190 |
|
||||
| Bit-shifts | `<<`, `>>` | 210 |
|
||||
| Object | `.` _(binds to right)_ | 240 |
|
||||
| _Others_ | | 0 |
|
||||
|
||||
A higher precedence binds more tightly than a lower precedence, so `*` and `/` binds before `+` and `-` etc.
|
||||
|
||||
When registering a custom operator, the operator's precedence must also be provided.
|
||||
| Unary operators | unary `+`, `-`, `!` _(binds to right)_ | 255 |
|
||||
|
@ -617,9 +617,9 @@ impl Token {
|
||||
|
||||
EqualsTo | NotEqualsTo => 90,
|
||||
|
||||
LessThan | LessThanEqualsTo | GreaterThan | GreaterThanEqualsTo => 110,
|
||||
In => 110,
|
||||
|
||||
In => 130,
|
||||
LessThan | LessThanEqualsTo | GreaterThan | GreaterThanEqualsTo => 10,
|
||||
|
||||
Plus | Minus => 150,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user