BalticAmadeus / AblFormatter

Code formatter for Progress OpenEdge (ABL)
Apache License 2.0
5 stars 0 forks source link

The end dot does not get parsed as part of ENUM defintion #215

Closed gustason closed 1 month ago

gustason commented 1 month ago

For example,

ENUM LiteraryMood FLAGS:
    define ENUM None = 0
                Joyful
                Melancholy
                Heroic
                Whimsical
                Epic
                JoyfulMelancholy = Joyful,Melancholy
                Tragic = Epic.
END ENUM.

The enum_statement gets parsed as ENUM LiteraryMood FLAGS: define ENUM None = 0 Joyful Melancholy Heroic Whimsical Epic JoyfulMelancholy Likewise, the enum_definition gets parsed as define ENUM None = 0 Joyful Melancholy Heroic Whimsical Epic JoyfulMelancholy = Joyful,Melancholy The . does not get parsed at all.

eglekaz commented 1 month ago

When I made the enum shorter, I see that end dot is parsed as a enum_definition. Image

From your description it looks like the information given by parser is just trimmed. Please check this again. If the issue is still there, we will submit the ticket

gustason commented 1 month ago

Another example:

ENUM Weather:
    define ENUM Rainy
                Default = Sunny
                Cloudy
                Snowy
                Apocalyptic.
END ENUM.

It is true that enum_definition contains a dot (define ENUM Rainy Default = Sunny Cloudy Snowy Apocalyptic.).

Nonetheless, if we parse all the children of enum_definition, this is what we get:

childType: DEFINE
childText: define
childType: ENUM
childText: ENUM
childType: enum_member
childText: Rainy
childType: enum_member
childText: Default = Sunny
childType: enum_member
childText: Cloudy
childType: enum_member
childText: Snowy
childType: enum_member
childText: Apocalyptic

The dot does not get parsed as part of the children, therefore we are left with this:

ENUM Weather:
    define ENUM Rainy
                Default = Sunny
                Cloudy
                Snowy
                Apocalyptic
END ENUM.
gustason commented 1 month ago

I suppose it is fine since the dot is always at the end so it can be easily added manually.