-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`1 + 2 *3` is currently evaluated as `(1+2)*3` while it should be `1 + (2*3)`. This is because the additive and multiplicative operators we're mixed in the same rule. Tests are only implemented in runtime right now as doing this in the parser is a bit tedious to write and it doesn't actually guaranteed the correct output. Fixes #2095
- Loading branch information
Showing
3 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
NAME operator_precedence_1 | ||
PROG BEGIN { print(1 + 2 * 3 ); exit() } | ||
EXPECT 7 | ||
TIMEOUT 5 | ||
|
||
NAME operator_precedence_2 | ||
PROG BEGIN { print(1 + 2 * 3 + 1); exit() } | ||
EXPECT 8 | ||
TIMEOUT 5 | ||
|
||
NAME operator_precedence_3 | ||
PROG BEGIN { print(1 + 2 * 3 + 1 * 10); exit() } | ||
EXPECT 17 | ||
TIMEOUT 5 | ||
|
||
NAME operator_precedence_3 | ||
PROG BEGIN { print(1 + 2 / 2 * 3); exit() } | ||
EXPECT 4 | ||
TIMEOUT 5 |