nitlang / nit

Nit language
http://nitlanguage.org
Apache License 2.0
239 stars 65 forks source link

It's not possible to comment an annotation #2786

Closed Delja closed 5 years ago

Delja commented 5 years ago

Currently annotation comment is not allowed. Example :

class A
    fun bar 
    is 
        foo
        #baz
    do
    end
end

This code make an Syntax Error: unexpected keyword 'do'.

Morriar commented 5 years ago
class A
    fun bar
    is
        # foo comment
        foo
        # bar comment
        bar
    do
    end
end
Morriar commented 5 years ago

Feel free to reopen if I misunderstood your issue.

lbajolet commented 5 years ago

I'd believe the aforementioned code should not provoke a syntax error as we have a single comment on a separate line, this definitely triggers my non POLA radar; the grammar should probably accept this @privat what do you think?

Delja commented 5 years ago

@Morriar my problem, it's the grammar should be normally accept a "free" comment in an annotation block without causing a syntax error. The same as it's possible to put a comment without link it to a method. example:

class A

    # Some comments blabla
    # [....]

    fun bar
    do
    end
end