[squeak-dev] Parser Pragma Issue and Fix
Rein, Patrick
Patrick.Rein at hpi.de
Mon Aug 17 11:58:39 UTC 2020
Hi everyone,
while working on a parser framework I recently discovered an issue when parsing the following method:
someTestMethod
'<' first
This method can not be parsed by the current Squeak parser, as it expects a closing angle bracket after the message send. The parser misinterprets the bracket in the string as the beginning of a pragma. The fault is in the Parser class which did not respect the type of the token to be parsed. The attached changeset is a proposed fix for the fault. It boils down to checking for the #binary token type in the the responsible parser method:
Parser>>#pragmaSequence
"Parse a sequence of method pragmas."
[ (hereType == #binary and: [self matchToken: #<])
ifFalse: [ ^ self ].
self pragmaStatement.
(self matchToken: #>)
ifFalse: [ ^ self expected: '>' ] ] repeat
As this is somewhat of a fundamental change, I wanted to bring this up for discussion before merging it.
Thanks and best wishes,
Patrick
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ParserPragmaFix.1.cs
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200817/d9276a8f/attachment.ksh>
More information about the Squeak-dev
mailing list
|