Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty statement list in PERFORM #241

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lsp/cobol_parser/grammar.mly
Original file line number Diff line number Diff line change
Expand Up @@ -3492,9 +3492,10 @@ let perform_statement [@context perform_stmt] :=
{ PerformTarget { perform_target = { procedure_start = i;
procedure_end = io };
perform_mode = po } }
| PERFORM; po = ro(perform_phrase); isl = imp_stmts; END_PERFORM;
| PERFORM; po = ro(perform_phrase); islo = imp_stmts?; END_PERFORM;
{ PerformInline { perform_inline_mode = po;
perform_statements = isl } }
perform_statements =
match islo with Some isl -> isl | None -> [] } }

let perform_phrase :=
| FOREVER; { PerformForever } (* GC/COBOL-IT extension *)
Expand Down
4 changes: 2 additions & 2 deletions test/output-tests/reparse.expected
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/Sort/InputSORT.CBL':
Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/Sort/MaleSORT.cbl':
Parse: OK. Reparse: OK.
Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/Strings/RefMod.cbl':
Parse: Failure.
Parse: OK. Reparse: OK.
Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/Strings/UnstringFileEg.cbl':
Parse: Failure.
Parse: OK. Reparse: OK.
Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/SubProg/DateValid/DateDriver.cbl':
Parse: OK. Reparse: OK.
Re-parsing `test/testsuite/microfocus/www.csis.ul.ie/SubProg/DateValid/ValiDate.cbl':
Expand Down
10 changes: 0 additions & 10 deletions test/output-tests/run_fundamental.expected
Original file line number Diff line number Diff line change
Expand Up @@ -697,16 +697,6 @@ Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5262:0
Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5313:0
Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5363:0
Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5426:0
run_fundamental.at-5426-prog.cob:30.11-30.22:
27 PERFORM VARYING MY-DATA-FIELD-1 FROM 1 BY 1
28 UNTIL MY-DATA-FIELD-1 > MY-DATA-FIELD-2
29 *> empty by design
30 > END-PERFORM.
---- ^^^^^^^^^^^
31 END-PAR.
32 MOVE "99" TO MY-DATA-FIELD-B.
>> Error: Invalid syntax

Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5486:0
Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5538:0
Considering: import/gnucobol/tests/testsuite.src/run_fundamental.at:5576:0
Expand Down
10 changes: 0 additions & 10 deletions test/output-tests/run_misc.expected
Original file line number Diff line number Diff line change
Expand Up @@ -565,16 +565,6 @@ Considering: import/gnucobol/tests/testsuite.src/run_misc.at:2517:0
Considering: import/gnucobol/tests/testsuite.src/run_misc.at:2543:0
Considering: import/gnucobol/tests/testsuite.src/run_misc.at:2586:0
Considering: import/gnucobol/tests/testsuite.src/run_misc.at:2612:0
run_misc.at-2612-prog.cob:10.11-10.22:
7 PROCEDURE DIVISION.
8 PERFORM VARYING INDVAL FROM 1
9 BY 1 UNTIL INDVAL > 2
10 > END-PERFORM
---- ^^^^^^^^^^^
11 IF INDVAL NOT = 3
12 DISPLAY INDVAL
>> Error: Invalid syntax

Considering: import/gnucobol/tests/testsuite.src/run_misc.at:2636:0
run_misc.at-2636-prog.cob:9.33-9.34:
6 01 INDVAL PIC 9(4).
Expand Down
19 changes: 0 additions & 19 deletions test/output-tests/syn_misc.expected
Original file line number Diff line number Diff line change
Expand Up @@ -2585,15 +2585,6 @@ Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:4385:0
Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:4578:0
Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:4614:0
Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:4771:0
syn_misc.at-4771-prog.cob:17.11-17.22:
14 PROCEDURE DIVISION.
15 PERFORM VARYING i FROM 1 BY 1
16 UNTIL i = 5
17 > END-PERFORM
---- ^^^^^^^^^^^
18 .
>> Error: Invalid syntax

Considering: import/gnucobol/tests/testsuite.src/syn_misc.at:4859:0
syn_misc.at-4859-prog1.cob:30.7-30.22:
27 DDATA
Expand Down Expand Up @@ -2787,16 +2778,6 @@ syn_misc.at-5576-prog.cob:39.11-39.23:
41 PERFORM WITH TEST BEFORE UNTIL 1 <> 3
>> Error: Invalid syntax

syn_misc.at-5576-prog.cob:42.11-42.22:
39 END-EVALUATE
40
41 PERFORM WITH TEST BEFORE UNTIL 1 <> 3
42 > END-PERFORM
---- ^^^^^^^^^^^
43
44 EVALUATE FALSE
>> Error: Invalid syntax

syn_misc.at-5576-prog.cob:47.11-47.23:
44 EVALUATE FALSE
45 WHEN A = B
Expand Down
Loading