[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: Sun, 1 Oct 2023 13:30:49 -0700
> It's only a short comment if the double hyphen is not followed immediately by an opening long bracket.
It's a short comment because the double hyphen is NOT followed by an
opening long bracket. It's followed by a bracket (--[), but it's not
it's not an opening long bracket, which has to be [[ or [=+[.
Paul.
On Sun, Oct 1, 2023 at 1:21 PM Bachir Bendrissou <babendrissou@gmail.com> wrote:
>
> Hi all,
>
> According to the spec (as Francisco has quoted above): It's only a short comment if the double hyphen is not followed immediately by an opening long bracket. Therefore the comment in my example cannot be a short/line comment.
>
> On the other hand, the comment can't be a valid long comment either. Because there is no corresponding closing long bracket!
>
> So, there is no valid way to parse the comment. Again, this conclusion is based on the Lua specification.
>
> Bachir
>
> On Sun, Oct 1, 2023 at 8:18 PM Paul Ducklin <pducklin@outlook.com> wrote:
>>
>> >So, is that parsed as a long or as a
>> >short comment?
>>
>> As Paul K explained, it’s a regular comment.
>>
>> It would only be the start of a long comment if it had *two* square brackets after the double-dash characters.
>>
>> (You can add one or more equals signs between the square brackets if you want, to create a unique marker.)
>>