|Anonymous | Login||10-26-2021 18:40 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0003616||[Squeak] Compiler||minor||always||05-13-06 22:29||04-18-10 21:54|
|Reporter||nicolas cellier||View Status||public|
|Assigned To||nicolas cellier|
|Summary||0003616: Enhancement of syntax : allow $- not only as first binary selector|
Current syntax does not allow $- in binary selector except in first position.
Original ST-80 aim was to avoid ambiguity caused by negated literal numbers, like in:
Based on this rule: spaces put around a binary selector should not be significative. In other words, spaces should not be mandatory.
Thus x - -2 sould give same resulta as x--2.
If we add a simple precedence rule: after first position, $- is not attached to the binary selector if it is immediately preceding a digit, then we can allow $- to appear anywhere.
Of course, grammar is more complex, you have to check two characters ahead, but that's already the case...
I provide a very light patch, only Scanner>>xBinary need being changed
Note that a separator is allowed in Squeak between the $- and following digit.
You can evaluate (- 2) and (1 - - 1).
This is not the case in VW ST-80 cousin...
Separator are simply ignored here, and a literal value is reconstituted...
With such rules, we could have (1 000) being interpreted (1000).
But that does not work inside array literal quotes #(- 2) is not #(-2).
So i do not much like this extension. It contributes to make the space rule less clear...
This behaviour is implemented in Parser>>primaryExpression.
I did not change it but just remind it.
|Attached Files||Compiler-Kernel-BinaryMinusEnhancement.1.cs [^] (450 bytes) 05-13-06 22:32|
(0013514 - 146 - 158 - 524 - 524 - 524 - 524)
(0013516 - 383 - 407 - 407 - 407 - 407 - 407)
Note: factoring -2 handling into scanToken leads to much simpler code, but it prevents code like ^x-1 to compile...
Forbidding (- 2) in primaryExpression by testing token positions (hereMark hereEnd mark...) is very hard due to the funky positions returned.
It is necessary to correct first these positions according to the values of the two steps ahead:
aheadChar then hereChar
(0013614 - 61 - 61 - 215 - 215 - 215 - 215)
|Fixed in http://source.squeak.org/trunk/Compiler-nice.120.mcz [^]|
|05-13-06 22:29||nicolas cellier||New Issue|
|05-13-06 22:32||nicolas cellier||File Added: Compiler-Kernel-BinaryMinusEnhancement.1.cs|
|02-23-10 16:41||nicolas cellier||Note Added: 0013514|
|02-24-10 01:09||nicolas cellier||Note Added: 0013516|
|04-01-10 20:10||nicolas cellier||Status||new => resolved|
|04-01-10 20:10||nicolas cellier||Fixed in Version||=> trunk|
|04-01-10 20:10||nicolas cellier||Resolution||open => fixed|
|04-01-10 20:10||nicolas cellier||Assigned To||=> nicolas cellier|
|04-01-10 20:10||nicolas cellier||Note Added: 0013614|
|04-18-10 21:54||andreas||Status||resolved => closed|
| Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
47 total queries executed.|
35 unique queries executed.