fix: raise precedence of is above equality operators in parser

The `is` operator was placed at `PREC_IS` which had lower precedence than `PREC_EQUALITY`, causing expressions like `true == 10 is Num` to parse incorrectly. Moved `PREC_IS` above `PREC_EQUALITY` in the precedence enum to give `is` higher binding power than `==` and `!=`. Added precedence tests in new `test/precedence.wren` file and removed TODO comments about precedence from `test/is/is.wren`.
This commit is contained in:
Bob Nystrom
2015-01-18 18:20:13 +00:00
parent 48c3f540df
commit 850d6d1b5d
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1311,8 +1311,8 @@ typedef enum
PREC_LOWEST,
PREC_ASSIGNMENT, // =
PREC_LOGIC, // && ||
PREC_IS, // is
PREC_EQUALITY, // == !=
PREC_IS, // is
PREC_COMPARISON, // < > <= >=
PREC_RANGE, // .. ...
PREC_BITWISE, // | &