Skip to content

Parsing error when code has functional methods as chained statements  #91

Closed

Description

@suynwa

When running abapCleaner on the following code snippet

class MAIN definition create public.

  public section.
    class-methods FOO importing PAR type I.

endclass.


class MAIN implementation.
  method FOO.
  endmethod.
endclass.

START-OF-SELECTION.
  MAIN=>FOO(:1 ), 2 ).

a parsing error is raised:

image

My expectation would be that abapCleaner splits the chained statement into multiple functional method calls:

MAIN=>FOO( 1 ).
MAIN=>FOO( 2 ).

Maybe the rule 'Unchain into multiple statements' can be enhanced.

You can refer to the ABAP documentation https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenchained_statements_guidl.htm#@@ITOC@@ABENCHAINED_STATEMENTS_GUIDL_1 for further guidelines on using chained statements.

Activity

  1. added
    documentationImprovements or additions to documentation
    wontfixThis will not be worked on
    on Aug 16, 2023
  2. jmgrassau commented on Aug 16, 2023

    @jmgrassau
    Member

    Hi suynwa,

    thanks for reporting this – this is a known limitation: A statement with one opening, but multiple closing parentheses completely contradicts the object model used in ABAP cleaner, and I don't think it would be feasible to rework that object model (allowing multiple closing tokens for the same opening token) just for the sake of these – hopefully rare – statements.

    What could be done, however, is to improve the error message for such cases (by specifically checking whether the issue is caused by a chain colon inside of brackets), and ask the user to rework that statement before ABAP cleaner can be used.

    The cleanup rule "Remove empty commands" also shows that horrible (but syntactically correct) things can be done with colons and commas…

    image

    Kind regards,
    Jörg-Michael

  3. self-assigned this
    on Sep 22, 2023
  4. jmgrassau commented on Sep 22, 2023

    @jmgrassau
    Member

    Hi Suhas,

    the next release will now show a more dedicated error message for this case:

    image

    Kind regards,
    Jörg-Michael

  5. jmgrassau commented on Sep 22, 2023

    @jmgrassau
    Member

    Hi Suhas,

    thanks again for bringing this up – version 1.5.4 with the improved error message was just released!

    Kind regards,
    Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationwontfixThis will not be worked on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions