uwol / proleap-cobol-parser

ProLeap ANTLR4-based parser for COBOL
MIT License
136 stars 74 forks source link

(too) rigid check of program-id. xxxx (NO DOT) #33

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 7 years ago

Once again - same "erro" category like previous issue. We do have several programs where the name of the program-id is not terminated with a DOT. (Sure the grammar insists on a dot - but most compilers dont check/insist on a DOT to terminate the name ...)

thus the parser runs into the next error:

Parsing file AAA02.cbl.
line 5:7 mismatched input 'ENVIRONMENT' expecting {COMMON, DEFINITION, INITIAL, IS, LIBRARY, DOT_FS}
Collecting units in file AAA02.cbl.

Cobollines with the incorrect declaration.

000010 IDENTIFICATION DIVISION.                          
000050 PROGRAM-ID.       AAA02 
000060******************************************************************07.05.15
      * not DOT after the name of the program-id !!!

Suggestion: though the parser is acting correctly - reality shows that most of the declarations like author or date-written or remarks etc (till input-output section) should be parsed with a rather error-forgiving algorithm.

uwol commented 6 years ago

I have relaxed the grammar for identification division entries such as the program id in 048043e2c08957201815844d713bdb21ec3a042c. Now, a DOT_FS is not required. Added a unit test.

Thanks!