[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Parse as long comment or as short comment?
- From: Paul K <paul@...>
- Date: Sat, 30 Sep 2023 23:34:35 -0700
> Should Lua return an error in this case? Or did I get that wrong?
No. Yes, because "an opening long bracket" has to match `[=*[` and a
single bracket doesn't.
Paul.
On Sat, Sep 30, 2023 at 11:05 PM Bachir Bendrissou
<babendrissou@gmail.com> wrote:
>
> Hi,
>
> Here is a short Lua input:
>
> local function name_s ( ) --[aaa
> end
>
> The Lua implementation accepts the input as valid. With the comment section "--[aaa" seemingly treated as a short comment.
>
> However, from the spec, I see that the comment is not supposed to be parsed as a short comment, because the text immediately after "--" is an opening long bracket. Likewise, the comment can't be parsed as a valid long comment, since there is no corresponding closing long bracket.
>
> Should Lua return an error in this case? Or did I get that wrong?
>
> Regards,
> Bachir
>