Skip to content

Improve insertText for variables located under OCCURS and qualified by OF/IN #2794

@efr15

Description

@efr15

When a statement mixes subscript and OF/IN qualifier, the syntax is a not intuitive (see language reference for COBOL 6.3 p. 70).
The subscript is only located at the right in the IN/OF sentence and can apply to the qualified variable, its parent or both.

For those data:

       01 ROOT-GROUP.
           05 PARENT1.
               10 VAR1 OCCURS 10  PIC X.
           05 PARENT2 OCCURS 10.
               10 VAR2            PIC X.
           05 PARENT3 OCCURS 10.
               10 VAR3 OCCURS 10  PIC X.

The syntax is:

           MOVE VAR1 OF PARENT1(1) TO VAR
           MOVE VAR2 OF PARENT2(1) TO VAR
           MOVE VAR3 OF PARENT3(1 1) TO VAR

Our completion tool is currently not able to manage the 1st case when the variable is an OCCURS but not the parent.
If completion is asked after MOVE it will suggest VAR1( because VAR1 is an OCCURS ( which is logic but syntactically wrong).
If completion is asked after OF it will suggest PARENT1 (because PARENT1 is not an OCCURS) and misses the subscript.

The 3rd case is also not managed correctly by our completion tool because it will miss one dimension and propose only a simple subscript instead of a double one.

Expected behavior
In the completion after IN/OF we should identify the qualified variable and add the subscript (or increment the occurs dimension) when it is an OCCURS.
Check also possible intermediate OCCURS.

Technical
See CompletionForInOrOf.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions