usagi-coffee / tree-sitter-abl

OpenEdge ABL grammar for tree-sitter
MIT License
7 stars 1 forks source link

INCLUDES and COMMENTS are not parsed as a part of Class Body #57

Closed eglekaz closed 2 months ago

eglekaz commented 2 months ago

Tree-sitter does not correctly recognize that classBody and body can start and end with an INCLUDE or COMMENT. Instead, it only considers include statements/comments as part of the body after the define statement. In the examples: 1st and 3rd occurrences of these components are not recognized as part of class_body.

Include example:

class Class final:
    {include/ttSomething.i}
    define public property prop as decimal initial 3.0 no-undo
        get.
        private set.

    {include/ttSomething.i}

    constructor private Class( ):
        m_NumCusts = 0.
    end.

    {include/ttSomething.i}
end class.

Comment example:

class Class final:
    ///Comment
    define public property prop as decimal initial 3.0 no-undo
        get.
        private set.

    ///Comment

    constructor private Class( ):
        m_NumCusts = 0.
    end.

    ///Comment
end class.
jkbz64 commented 2 months ago

This one is complicated, already kind of answered in https://github.com/usagi-coffee/tree-sitter-abl/issues/42#issuecomment-2255513007 but this time s/whitespace/include or comment, putting comment and include explicitly in class body element breaks too, so yeah...