uwol / proleap-cobol-parser

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

correct, though too rigid check of declaration order . #32

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 7 years ago

First of all - no doubt, your parser is right in "insisting" on the defined order of

environment division.
object-computer. xxx.
source-computer xxx.
special-names.

We all know that the object-computer and source-computer clause is more or less to be treated like a comment only (apart from the option with debugging mode attached to the source-computer)

We/our customer has a couple of programs with the WRONG order of these options (refer to the attachted Cobol program). No doubt, this should be at least a warning under ibm-cobol as well, but it is not ...

Your strict parser rules run into the next error messages: I think, as ease of use, the parser should not be too rigid on the order of all these options which are more or less like an "intelligent" comment in Cobol ...

> Parsing file AAA01.CBL.
> line 15:7 mismatched input 'OBJECtT-COMPUTER' expecting <EOF>
> Collecting units in file AAA01.CBL.
> 
[AAA01.cbl.txt](https://github.com/uwol/cobol85parser/files/1205597/AAA01.cbl.txt)
uwol commented 6 years ago

The issue has been fixed in 1328477a920c374cb4db8fc7103ce788d27c181b. Now, a special names paragraph can be contained in a configuration section. Also added a unit test.

Thanks!