-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This bugfix introduces negative numbers into our parser: before, -10 would be parsed as (minus, number) whereas right now it's going to be parsed as (number) only. This fixes a bug with precedences, where `-1.str()` would be parsed as (-, (1, str)), leading to first calling the str method on the positive number, then applying the minus. Before: ``` ⧐ -1.234.str() ERROR: unknown operator: -STRING [1:1] -1.234.str() ``` After: ``` ⧐ -1.234.str() -1.234 ``` If a space is found between the minus and the number, the old parsing mechanism still applies. I found inspiration in Ruby, where: ``` $ - 1.to_s() -@: undefined method `-@' for "1":String $-1.to_s() -1 $ -10.3.floor() -11 $ - 10.3.floor() -10 ```
- Loading branch information
Showing
6 changed files
with
27 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.1 | ||
2.2.2 |
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
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