<div dir="ltr"><div>Hi Eliot,</div><div><br></div><div>My example was a bit oversimplified - I would agree that the "outer" comment could be attributed to the block instead of the statement, but that's not what's happening, the outer comment gets attributed to the block's last statement (if the block's last statement does not end in period).</div><div><br></div><div>So, if the example changes to:</div><div><br></div><div>test<br>true ifTrue: [<br>       "block inner comment"<br>       ^self "return comment"] "outer comment"</div><div><br></div><div>the outer comment does not get attributed to the block, but to the return statement. I don't think this can be construed as correct</div><div><br></div><div>Also, by adding an inner period (after the return, inside the block), the outer comment suddenly does not get attributed to the block or to any of the block's statements anymore, but to the outer statement, although the outer statement still does not have a terminating statement separator</div><div><br></div><div>
test<br>true ifTrue: [<br>  "block inner comment"<br>       ^self. "return comment"] "outer comment"

</div><div><br></div><div><br></div><div><br></div><div>For another example that I think is more obvious:</div><div><br></div><div>test<br>^true ifTrue: [<br>"block comment"<br>self "return value comment"]</div><div><br></div><div>Here, the return value comment, although written after the last statement, is moved before the statement and attributed to the block.</div><div><br></div><div><br></div><div>That said, I know that you are doing more important work, and that the ideal attachment of comments to their intended parse nodes is not a main concern for most people (and in some situations there may not even be an agreement on what the ideal interpretation is). <br></div><div>Plus, in the cases where this truly matters for me, there is a workaround - I can play around with the periods until I get the result I want - so it is not the highest priority for me either. But I'll put it on my todo list<br></div><div><br></div><div>Cheers,</div><div>Florin<br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 16, 2023 at 1:25 PM Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Florin,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 12, 2023 at 9:21 PM Florin Mateoc <<a href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Eliot,</div><div><br></div><div>Thank you for the quick fix, but I have one more example of misbehavior when parsing comments. The issue is that the last period (or lack thereof) makes a difference with regards to associating the comment with the correct parse node.</div><div><br></div><div>For example, when parsing:<br></div><div><br></div><div>test<br>               true ifTrue: ["inner comment"] "outer comment"</div><div><br></div><div>the parser associates both comments to the inside of the block, whereas if we include the period, like so:</div><div><br></div><div>test<br>              true ifTrue: ["inner comment"]. "outer comment"</div><div><br></div><div>it correctly leaves the inner comment inside and the outer comment outside</div></div></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Given that period is a statement separator this is arguably correct.  Not sure I want to try and fix this one.  But you're welcome to propose a fix and I'll happily review it.</div><div class="gmail_default" style="font-size:small"><br></div></div><div dir="ltr"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>
<br>
</blockquote></div>