BalticAmadeus / AblFormatter

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

Issue with Temp table formatting #165

Closed PauliusKu closed 2 months ago

PauliusKu commented 2 months ago

This:

define TEMP-TABLE ttColumn NO-UNDO
FIELD cName AS CHARACTER SERIALIZE-NAME "name"
FIELD cKey AS CHARACTER SERIALIZE-NAME "key"
.

becomes this:

define TEMP-TABLE ttColumn NO-UNDO
    FIELD cName AS CHARACTER. SERIALIZE-NAME "name"
FIELD cKey AS CHARACTER SERIALIZE-NAME "key"
.

Probably due to SERIALIZE-NAME

gustason commented 2 months ago

Tree sitter considers only FIELD cName AS CHARACTER as part of the field_definition. The field_definition should be FIELD cName AS CHARACTER. SERIALIZE-NAME "name".

gustason commented 2 months ago

Therefore, in the code

DEFINE TEMP-TABLE ttColumn NO-UNDO
FIELD cName AS CHARACTER. SERIALIZE-NAME "name"
FIELD A AS CHARACTER SERIALIZE-NAME "key"
FIELD B AS CHARACTER SERIALIZE-NAME "key"
FIELD C AS CHARACTER SERIALIZE-NAME "key"
.

all the fields after the first do not get parsed as field definitions but as one abl_statement: image

PauliusKu commented 2 months ago

Link: https://github.com/usagi-coffee/tree-sitter-abl/issues/67

eglekaz commented 2 months ago

Fixed with version 0.0.31 of tree-sitter-abl