[gcc r17-2633] cobol: Restrict CDF reserved words to CDF parsing.

"James K. Lowden via Gcc-cvs" <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:f128c347d5278a521f8101a4a237493a25e6f143

commit r17-2633-gf128c347d5278a521f8101a4a237493a25e6f143
Author: James K. Lowden <[email protected]>
Date:   Wed Jul 22 18:16:43 2026 -0400

    cobol: Restrict CDF reserved words to CDF parsing.
    
    Among others PARAMETER was captured as a reserved word during normal
    parsing, which it is not.  Move that and some other obvious CDF tokens
    to the cdf_state start condition.
    
    gcc/cobol/ChangeLog:
    
            * scan.l: Make PARAMETER and friends unspecial outside CDF.

Diff:
---
 gcc/cobol/scan.l | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l
index fedb85e502c4..0b3bcc38c2f2 100644
--- a/gcc/cobol/scan.l
+++ b/gcc/cobol/scan.l
@@ -1742,6 +1742,13 @@ USE({SPC}FOR)?		{ return USE; }
 }
 
 <cdf_state>{
+  CALL-CONVENTION	{ return CALL_CONVENTION; }
+  COBOL-WORDS		{ return COBOL_WORDS; }
+  DEFINE		{ return CDF_DEFINE; }
+  OVERRIDE		{ return OVERRIDE; }
+  PARAMETER		{ return PARAMETER_kw; }
+  SOURCE{BLANK}FORMAT	{ return SOURCE_FORMAT; }
+
   [+-]?{INTEGERZ}       { int value;
 			  if( is_integer_token(&value) ) {
 			    ydflval.number = value;
@@ -2392,10 +2399,10 @@ BASIS		{ yy_push_state(basis); return BASIS; }
   .				{ yy_pop_state(); return RAISING; } // invalid syntax
 }
                 /*
-                 * Catch-all
+                 * Catch-all These tokens may occur anywhere, and may invoke
+		 * the CDF. Token specific to the CDF belong in the <cdf_state>
+		 * start condition.
                  */
-
-
 <*>{
   ^[ ]{6}D.*\n 	{
 		  if( !is_fixed_format() ) {
@@ -2444,17 +2451,10 @@ BASIS		{ yy_push_state(basis); return BASIS; }
 
 
   OTHER		{ return OTHER; }
-  OVERRIDE	{ return OVERRIDE; }
-  PARAMETER	{ return PARAMETER_kw; }
   THRU		{ return THRU; }
   TRUE		{ return TRUE_kw; }
 
   ALL			{ return ALL; }
-  CALL-CONVENTION	{ return CALL_CONVENTION; }
-  COBOL-WORDS		{ return COBOL_WORDS; }
-  DEFINE		{ return CDF_DEFINE; }
-  SOURCE{BLANK}FORMAT	{ return SOURCE_FORMAT; }
-
 }
 
 <cobol_words>{
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.