https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120786

James K. Lowden <jklowden at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jklowden at gcc dot 
gnu.org
   Last reconfirmed|                            |2025-06-23
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from James K. Lowden <jklowden at gcc dot gnu.org> ---
Per ISO: 

  8.3.1 General

  The lexical elements are character-strings and separators.

  A character-string is a character or a sequence of contiguous characters that
forms a COBOL word, a literal, or a picture character-string. A
character-string is delimited by separators.

"NOT" and "=" are COBOL words; "NOT=" is not.  It's interesting that MF accepts
it, because they say they don't. 
https://www.microfocus.com/documentation/visual-cobol/vc90/DevHub/HRLHLHPDF60A.html
says, "A space must precede and follow each reserved word comprising the
relational operator."

This PR has two possible resolutions: 

1. a better error message, "NOT requires a separating space", and/or
2. accept "NOT=" as "NOT =". 

If #2, what is the rule?  The parser could accept e.g. NOTEQUAL, which today is
a user-defined word. Is there a non-Latin rule that algebraic operators have
implied separator space?  That would mean 

   NOT<=-1

would be acceptable.  

NOT is a versatile word in COBOL.  The error message is due to the fact that
the gcobol parser does not recognize "NOT =" as two tokens; rather, the scanner
reads "NOT =" and returns a single NE token.  (That arrangement likewise
rejects NOT NOT =).

Reply via email to