2015-09-25 9:53 GMT+02:00 Thierry Goubier <thierry.goubier@gmail.com>:
Note for ref on the original point:
ANSI Smalltalk allow for space between - and the number token. Squeak is then non A
For the new point:
ANSI Smalltalk does not allow for space between # and the selector, or between # and the quoted string.
Should be an easy fix.
Note to self for later: RBScanner>>#scanLiteral call stripSeparators before checking $# and calling again scanLiteral, which means it has a good chance of calling stripSeparators twice when dealing with the beginning of a symbol. Thierry
Marcus, how do we should validate RBParser changes? Reparse all the code in the image and compares ASTs?
Thierry
2015-09-25 8:52 GMT+02:00 Nicolai Hess <nicolaihess@web.de>:
2015-09-24 22:39 GMT+02:00 Thierry Goubier <thierry.goubier@gmail.com>:
Le 24/09/2015 09:11, Nicolai Hess a écrit :
2015-09-24 8:19 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com <mailto:i.uhnak@gmail.com>>:
> - 250 * 1.5 returns -2.25
why is this valid syntax?
I don't know if this is valid syntax (I always wondered that there is one place in PointTest, that is not compilable with old compiler but compiles fine with opal). But the error happens in RBParser>>#parseNegatedNumber. If a #- is recognized, it tests if a literalnumber follows (but from the token stream, that is, the spaces are ignored). Now the real bug is, that we do two "steps" and concstruct a new literalvaluenode from the now following tokens. RBParser parseExpression:'- 2' -> throws an error, because no following tokens RBParser parseExpression:'- 2 * 3' -> works but actually duplicates the two last tokens "*3 *3. and some funny other things '- 2@1' -> '-1@1'
Another one I found in the tests: would you expect
RBParser parseExpression: '#
1 = 1'
To be the same thing as '#1 = 1' ?
I tested this in squeak and it seems that #1 isn't allowed as symbol, the only way to use a digit as symbol is #'1' (is this defined in smalltalks syntax defintion?)
-> Parsing '#' has to be fixed too.
Thierry