[Bug cobol/126498] New: cobol1: bad reserved word LOG (intrinsic function names?)

simonsobisch at gnu dot org via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126498

            Bug ID: 126498
           Summary: cobol1: bad reserved word LOG (intrinsic function
                    names?)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: cobol
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simonsobisch at gnu dot org
  Target Milestone: ---

some.cob:39:40: error: syntax error, unexpected LOG, expecting NAME
   39 |            SELECT OPTIONAL             LOG
      |                                        ^~~                    ^~~ 

... which is a bison parser error.
But LOG is not a reserved word per standard, so that should not happen.

I _guess_ that is related to FUNCTION LOG which also can be written as LOG
*iff*  ALL INTRINSIC (or the specific intrinsic) is coded in the REPOSITORY
paragraph.


What GnuCOBOL does (=why it works there):
* have a FUNCTION_LOG token defined
* the scanner checks FUNCTION - the next token is FUNC_NAME if it is not part
of the intrinsic list (which can, per standard, be adjusted!), otherwise WORD
(which seems to be the equivalent of NAME)
* if a WORD is seen, the scanner checks if it is in the REPOSITORY initrinisic
list, if yes, it returns FUNCTION_LOG, otherwise it returns WORD

I think cobol1 needs to do something similar
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.