Posted: Thu Jul 26, 2007 1:15 am
If you add a line break after line 1315 the fold will go away:1) Line 1315 shows a fold for no apparent reason. This is a minor issue.
Line 1329 is similar, and there are many others.
So this:
Code: Select all
34111 COPY DDR-ALL-FORMATS OF MEM510E2.
34653 FD MEM510E3-PACWEST-EXT-FILE.
Code: Select all
34111 COPY DDR-ALL-FORMATS OF MEM510E2.
34653 FD MEM510E3-PACWEST-EXT-FILE.
I think one major problem with the current folder is that it is not ignoring the text in the first 7 columns. I think this logic is added a lot of these ghost folds would go away2) Comments seem to confuse the folder.
3) Multiple lines seems to confuse the folder.

Is there any significance to the 5 digit numbers at the start of these lines. Can they be ignored

The problem here is there are many PERFORM with out a matching END-PERFORM.4) In the procedure division, each time a verb is used that has a
corresponding END- form (e.g. PERFORM/END-PERFORM, ACCEPT/END-ACCEPT,
etc.), the fold extends to the end of the program if the END- terminator
is not present.
For example this code will not fold correctly:
Code: Select all
IF WK-ACTMPH-EOFSEC = 'Y'
PERFORM P5400-REINSTATE-REVERSE
IF WK-POST-TRAN-CODE-D87
MOVE WK-MSG (75) TO WK-PRT-MESSAGE
END-IF
END-IF
Code: Select all
IF WK-ACTMPH-EOFSEC = 'Y'
PERFORM
P5400-REINSTATE-REVERSE
END-PERFORM
IF WK-POST-TRAN-CODE-D87
MOVE WK-MSG (75) TO WK-PRT-MESSAGE
END-IF
END-IF
Unfortunately due to limitations of the Zeus folder all folds must have matching begin/end fold points otherwise it will get confusedFor an example, see line 4275. Use of the END- terminator
is not required, and in older programs is uncommon. Even newer programs
tend not to use them when not needed.

The best thing to do would be to remove things like PERFORM as a fold points.
So of these current fold points:
Code: Select all
ACCEPT
ADD
CALL
COMPUTE
DELETE
DIVIDE
EVALUATE
IF
MULTIPLY
PERFORM
READ
RETURN
REWRITE
SEARCH
START
STRING
SUBTRACT
UNSTRING
WRITE

In all of these cases, a period will serve as a terminator of all
previously unterminated statements
Unfortunately the period really can't be used as a fold point because it depends heavily on context.
For example in the code below the period would be an end of fold point:
Code: Select all
CALL 'TRUNCENT' USING WK-PROCESS-DATE-N,
WK-DATE-FMT-MDY.
Code: Select all
MOVE WK-PROCESS-DATE
TO WK-DATE-1.
I'm definitely open to any suggestions1) The ability to turn off cetain types of folding. For instance, I think
the statement folding in the PROCEDURE DIVISION will be very difficult to
get right without a syntax analysis.

I'll have to think about this, but my first impression is this will be difficult.2) The ability to fold contiguous comments. As an example see the large
comment block at the beginning. Lines 4-1151 could be folded.
The reason is, for this type of pattern to be folded the file would need to be parsed from top to bottom. But to do top to bottom parsing on every key press would make the program far too slow.
3) The ability to fold paragraphs, particularly in the PROCEDURE DIVISION.
This might be possible. I'll have a closer look at this.
The major issue for Zeus in terms of folding is the speed. Because it only takes on one character to be added or remove to change the fold state of the line, the fold checking must be done on ever key press and as such it has to be fast.Any information you can share regarding interfaces you might need would be helpful in planning this.
Zeus achieves this by only ever checking the current line for folds.
But this approach will only work for languages that have clearly defined matching begin/end fold points.
Cheers Jussi