[squeak-dev] [BUG] Parser does not detect syntax error with double colon
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Wed Mar 4 11:20:19 UTC 2020
Hi all,
I took a look into the parser/scanner, let me ask you a few questions:
Is it an important requirement that the compiler must be able to understand symbols such as #value::? Should these by valid symbols at all?
If not, we could change the following line in Scanner >> #xLetter:
tokenType := (type == #xColon and: [aheadChar ~~ $=] and: [aheadChar ~= $:])
Otherwise, we could insert a validation of selector in #messagePart:repeat:. Something like:
selector readStream in: [:stream |
words do: [:word |
(stream take: word size - 1)
indexOf: $:
ifPresent: [:index | self notify: 'Argument expected' at: word start + index].
stream skip: 1]].
Looking forward to your thoughts!
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 28. Februar 2020 14:17:20
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] [BUG] Parser does not detect syntax error with double colon
Hi Christoph.
Thanks for pointing this out. This issue has been around for like forever. :-) In Squeak 3.8, however, the list of choices was bigger:
[cid:c5e6430d-9da0-4890-bf22-d5e98561f9b0]
Let's improve this in 6.0alpha :-)
Best,
Marcel
Am 28.02.2020 13:49:03 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
Steps to reproduce:
Try doIt this (for example, in a workspace):
2 raisedTo:: 3.
Expected behavior:
2 raisedTo:"Argument expected ->": 3.
Actual behavior:
[cid:c80a10c0-c0f3-449a-b34d-733c44256241]
If you are thumb enough to choose #raisedTo:: (I was), you get a subsequent error:
[cid:c80d78da-81df-4634-82c0-1721a66c80c2]
Even worse: If you try to doIt the same code snippet again, no parser warning/error will be raised at all but you get a runtime error:
MessageNotUnderstood: SmallInteger>>raisedTo::.
Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200304/ca657780/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 9556 bytes
Desc: image.png
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200304/ca657780/attachment.png>
More information about the Squeak-dev
mailing list
|