Skip to content

Commit ac550ba

Browse files
committed
Merge SVN 4736
1 parent c702802 commit ac550ba

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

cobc/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175
* typeck.c (validate_occurs): change level 01/77 check back to plain
176176
dialect verification fixing #854
177177

178+
2022-10-04 Nicolas Berthier <[email protected]>
179+
180+
* pplex.l, parser.y: fix AREACHECK in DEFAULT SECTION of CONTROL DIVISON
181+
178182
2022-10-04 Simon Sobisch <[email protected]>
179183

180184
* codegen.c (output_internal_function): only close files on CANCEL-callback

cobc/parser.y

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,7 +3618,8 @@ _default_clauses:
36183618

36193619
_default_accept_clause:
36203620
/* empty */
3621-
| ACCEPT _is word_or_terminal
3621+
| ACCEPT { check_non_area_a ($1); }
3622+
_is word_or_terminal
36223623
{
36233624
CB_PENDING ("ACCEPT statement in DEFAULT SECTION");
36243625
/* TODO: setup_default_accept ($3); */
@@ -3627,7 +3628,8 @@ _default_accept_clause:
36273628

36283629
_default_display_clause:
36293630
/* empty */
3630-
| DISPLAY _is word_or_terminal
3631+
| DISPLAY { check_non_area_a ($1); }
3632+
_is word_or_terminal
36313633
{
36323634
CB_PENDING ("DISPLAY statement in DEFAULT SECTION");
36333635
/* TODO: setup_default_display ($3); */

cobc/pplex.l

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,16 @@ MAYBE_AREA_A [ ]?#?
492492
return CONTROL_STATEMENT;
493493
}
494494

495-
^{AREA_A} {
495+
<*>^{AREA_A} {
496496
/* Output a special marker that precedes lines starting in area A. This
497-
is required to detect missing periods.
497+
is required to detect some missing periods.
498498
499499
See "(*area-a*)" in `ppinput' function below for the code that emits
500500
the `#'.
501501
502-
The optional space before '#' in the rule above is only needed to
503-
properly handle the first line in each buffer, that for some reason
504-
always starts with a space.
502+
The optional space before '#' in the definition of AREA_A is only
503+
needed to properly handle the first line in each buffer, that for
504+
some reason always starts with a space.
505505
*/
506506
fprintf (ppout, "\n#area_a\n");
507507
}
@@ -555,7 +555,6 @@ SUBSTITUTION_SECTION_STATE>{
555555
cb_source_line++;
556556
}
557557
[,;]?[ ]+ { /* ignore */ }
558-
^{AREA_A} {}
559558
}
560559

561560
<INITIAL,
@@ -1004,7 +1003,6 @@ ENDIF_DIRECTIVE_STATE>{
10041003
cb_source_line++;
10051004
}
10061005
[,;]?[ ]+ { /* ignore */ }
1007-
^{AREA_A} {}
10081006
[_0-9A-Z\x80-\xFF-]+(\.[_0-9A-Z\x80-\xFF-]+)+ {
10091007
/* special case to allow copybook names with periods
10101008
without a literal
@@ -1047,12 +1045,6 @@ ENDIF_DIRECTIVE_STATE>{
10471045
cb_source_line++;
10481046
}
10491047

1050-
^{AREA_A} {
1051-
/* Pseudo-text words that start in area-a retain that property, and
1052-
should thus be preceded with the marker. */
1053-
pplval.s = cobc_plex_strdup ("\n#area_a\n");
1054-
}
1055-
10561048
[,;]?[ ]+ {
10571049
pplval.s = cobc_plex_strdup (" ");
10581050
return TOKEN;

tests/testsuite.src/syn_misc.at

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9290,6 +9290,42 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [OK], [])
92909290
AT_CLEANUP
92919291

92929292

9293+
AT_SETUP([CONTROL DIVISION & AREACHECK])
9294+
AT_KEYWORDS([gcos])
9295+
9296+
AT_DATA([prog.cob], [
9297+
CONTROL DIVISION.
9298+
SUBSTITUTION SECTION.
9299+
*> This REPLACE in Area A is ignored for now:
9300+
REPLACE IISS BY IS
9301+
TERM BY TERMINAL
9302+
"KO" BY "OK".
9303+
DEFAULT SECTION.
9304+
ACCEPT ALTERNATE CONSOLE
9305+
DISPLAY IISS TERM
9306+
.
9307+
IDENTIFICATION DIVISION.
9308+
PROGRAM-ID. prog.
9309+
DATA DIVISION.
9310+
WORKING-STORAGE SECTION.
9311+
01 VAR PIC X(2) VALUE "KO".
9312+
PROCEDURE DIVISION.
9313+
DISPLAY VAR
9314+
STOP RUN.
9315+
])
9316+
9317+
AT_CHECK([$COMPILE -std=gcos-strict prog.cob], [0], [],
9318+
[prog.cob:9: warning: start of statement in Area A
9319+
prog.cob:9: warning: ACCEPT statement in DEFAULT SECTION is not implemented
9320+
prog.cob:10: warning: start of statement in Area A
9321+
prog.cob:10: warning: DISPLAY statement in DEFAULT SECTION is not implemented
9322+
prog.cob:18: warning: start of statement in Area A
9323+
prog.cob:19: warning: start of statement in Area A
9324+
])
9325+
9326+
AT_CLEANUP
9327+
9328+
92939329
AT_SETUP([PICTURE L])
92949330
AT_KEYWORDS([extensions gcos picture-l])
92959331

0 commit comments

Comments
 (0)