[Cuis-dev] Subtle Parser bug?

Nicolás Papagna Maldonado nicolas.papagna at gmail.com
Mon Nov 30 12:11:58 PST 2020


Hi Phil!

Indeed!

I was wondering if that should be allowed in the first place because it is
a 'mistake' that the system is allowing you to make (as you mention, the
bug is in the code and was compiled just fine).

Best,
Nico


On Mon, Nov 30, 2020 at 4:21 PM Phil B <pbpublist at gmail.com> wrote:

> Hi Nico,
>
> The bug is in your source code ;-)  The self is due to the fact that you
> have 'foo.' instead of just 'foo' (i.e. you don't need the $. to terminate
> your args and any empty expressions in the body, which the trailing $. will
> be parsed as, will result in a self).
>
> Thanks,
> Phil
>
> On Mon, Nov 30, 2020 at 7:59 AM Nicolás Papagna Maldonado via Cuis-dev <
> cuis-dev at lists.cuis.st> wrote:
>
>> Hi folks!
>>
>> Hope. you're doing fine :)
>>
>> I ran into this (bug?) yesterday while inspecting existing compiled
>> methods at Cuis University.
>> Looks like if you parse/compile a method that has a dot after the last
>> collaborator in the method signature, an additional *self* node is added
>> to the AST.
>>
>> To reproduce it, in a workspace inspect:
>>
>> Parser new
>>   parse: 'm1: foo. ^1'
>>   class: Object
>>
>> You'll note that the string representation of the inspected MethodNode
>> displays:
>>
>> m1: foo
>>   *self.*
>>   ^ 1.
>>
>> Is that little *self *node there for a reason, or is it just a bug?
>>
>> Best,
>> Nico PM
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
>

-- 

Nicolás Papagna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20201130/13cdc6e5/attachment.htm>


More information about the Cuis-dev mailing list