[Cuis-dev] Subtle Parser bug?

Phil B pbpublist at gmail.com
Mon Nov 30 16:17:23 PST 2020


I don't think it's technically a bug, just an empty (null?) expression.  It
actually has its uses when you want to 'force' a comment at a specific
place.  So you use it in combination with a comment so that the pretty
printer doesn't 'fix' things for you and put it where you don't want it.

On Mon, Nov 30, 2020 at 3:12 PM Nicolás Papagna Maldonado <
nicolas.papagna at gmail.com> wrote:

> 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/d050a911/attachment.htm>


More information about the Cuis-dev mailing list