Add boolean xor operator and readjust % precedence.
This commit is contained in:
parent
05a4b466d1
commit
d9fe6a1980
@ -15,6 +15,7 @@ Breaking changes
|
|||||||
|
|
||||||
* `EvalAltResult::ErrorMismatchOutputType` has an extra argument containing the name of the requested type.
|
* `EvalAltResult::ErrorMismatchOutputType` has an extra argument containing the name of the requested type.
|
||||||
* `Engine::call_fn_dynamic` take an extra argument, allowing a `Dynamic` value to be bound to the `this` pointer.
|
* `Engine::call_fn_dynamic` take an extra argument, allowing a `Dynamic` value to be bound to the `this` pointer.
|
||||||
|
* Precedence of the `%` (modulo) operator is lowered to below `<<` ad `>>`. This is to handle the case of `x << 3 % 10`.
|
||||||
|
|
||||||
New features
|
New features
|
||||||
------------
|
------------
|
||||||
@ -25,6 +26,7 @@ New features
|
|||||||
* `Engine::register_custom_operator` to define a custom operator.
|
* `Engine::register_custom_operator` to define a custom operator.
|
||||||
* New low-level API `Engine::register_raw_fn`.
|
* New low-level API `Engine::register_raw_fn`.
|
||||||
* `AST::clone_functions_only`, `AST::clone_functions_only_filtered` and `AST::clone_statements_only` to clone only part of an `AST`.
|
* `AST::clone_functions_only`, `AST::clone_functions_only_filtered` and `AST::clone_statements_only` to clone only part of an `AST`.
|
||||||
|
* The boolean `^` (XOR) operator is added.
|
||||||
|
|
||||||
|
|
||||||
Version 0.16.1
|
Version 0.16.1
|
||||||
|
@ -2444,6 +2444,7 @@ fn run_builtin_binary_op(
|
|||||||
match op {
|
match op {
|
||||||
"&" => return Ok(Some((x && y).into())),
|
"&" => return Ok(Some((x && y).into())),
|
||||||
"|" => return Ok(Some((x || y).into())),
|
"|" => return Ok(Some((x || y).into())),
|
||||||
|
"^" => return Ok(Some((x ^ y).into())),
|
||||||
"==" => return Ok(Some((x == y).into())),
|
"==" => return Ok(Some((x == y).into())),
|
||||||
"!=" => return Ok(Some((x != y).into())),
|
"!=" => return Ok(Some((x != y).into())),
|
||||||
_ => (),
|
_ => (),
|
||||||
|
13
src/token.rs
13
src/token.rs
@ -394,18 +394,17 @@ impl Token {
|
|||||||
|
|
||||||
And | Ampersand => 60,
|
And | Ampersand => 60,
|
||||||
|
|
||||||
LessThan | LessThanEqualsTo | GreaterThan | GreaterThanEqualsTo | EqualsTo
|
EqualsTo | NotEqualsTo => 90,
|
||||||
| NotEqualsTo => 90,
|
|
||||||
|
|
||||||
In => 110,
|
LessThan | LessThanEqualsTo | GreaterThan | GreaterThanEqualsTo => 110,
|
||||||
|
|
||||||
Plus | Minus => 130,
|
In => 130,
|
||||||
|
|
||||||
Divide | Multiply | PowerOf => 160,
|
Plus | Minus => 150,
|
||||||
|
|
||||||
LeftShift | RightShift => 190,
|
Divide | Multiply | PowerOf | Modulo => 180,
|
||||||
|
|
||||||
Modulo => 210,
|
LeftShift | RightShift => 210,
|
||||||
|
|
||||||
Period => 240,
|
Period => 240,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user