diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index f742a5a756aa8c6fab6fbd05107661da5ca828d5..5b0e553ec26a52e8c1522e79d11f3958e0f00c5a 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -598,8 +598,7 @@ PLUS { return PLUS; } PICTURE { return PICTURE; } PH { return PH; } PF { return PF; } -PERFORM { yylval.boolean = false; return PERFORM; } - +PERFORM { yylval.boolean = false; return PERFORM; } PERFORM{SPC}CYCLE { yylval.boolean = true; return PERFORM; } PAGE-COUNTER { return PAGE_COUNTER; } @@ -1500,7 +1499,7 @@ USE({SPC}FOR)? { return USE; } STACK { return STACK; } TOP-LEVEL { return TOP_LEVEL; } - {NAME}/{SPC}SECTION { yylval.string = strdup(yytext); + {NAME}/{SPC}SECTION\b { yylval.string = strdup(yytext); return NAME; } (IS{SPC})?POSITIVE/[[:space:]] { yylval.number = IS; return POSITIVE; } diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index b111c60710d5b62ad1b6e2ae73b04daedd35693b..572b831bd99e61a20fa98bf6b8f820edf82fd018 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -3995,10 +3995,8 @@ symbol_label_add( size_t program, cbl_label_t *input ) /* * Under ISO (and not IBM) Declaratives are followed by a Section name. When - * the first statement is parsed, the last symbol in the table is the first - * symbol, if any, in the Procedure Division. If it's a user-defined Section - * name, it doesn't matter if there are Declaratives. Else check to see if - * there *are* Declaratives to notify the user of the missing Section name. + * the first statement is parsed, verify, if Declaratives were used, that it + * was preceeded by a Section name. */ bool symbol_label_section_exists( size_t program ) {