We are trying to parse Cobol sources.
Versions used:
Cobol: AcuCobol version 10.2.1, fixed format
SonarQube: Enterprise Edition Version 9.6.1 (build 59531)
The ‘FUNCTION RANDOM’ statement below compiles, although it does not comply to the Acucobol spec. It is however used in the reference manual as an example.
This fact causes developers to use the function in the shown way.
It does not parse, but inserting a ‘0’ between the parenthesis fixes that.
Extract from the parser logfile:
ERROR: Unable to parse COBOL source file : /build/builds/_NwxSV3v/0/dataserver-utilities/tdeltaplayground/sonar-parse-errors/cobol-src/source/PP0023 at line 11
Original contents starting from line 1 till line 12:
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0023.
WORKING-STORAGE SECTION.
01 VARIABLE PIC S9V999.
PROCEDURE DIVISION.
MOVE FUNCTION RANDOM() TO VARIABLE
GOBACK.
Preprocessed contents:
Parse error at line 11:
1: IDENTIFICATION DIVISION .
2: PROGRAM-ID . PP0023 .
3: WORKING-STORAGE SECTION .
4: 01 VARIABLE PIC S9V999 .
5: PROCEDURE DIVISION .
11: MOVE FUNCTION RANDOM ( ) TO VARIABLE
^
12: GOBACK .
13: EOF
Please have the parser accept this syntax.