uwol / proleap-cobol-parser

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

Copy-book resolution error #45

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 6 years ago

Suppose you include a copy book in speficying an extension in the name of the copybook but using no qoutes. Thus the Copy-statement looks like:

COPY abc.cpy

=> the copy book is resolved and found correctly, but the ".cpy" extension is split into a new line, somehow looking like:

      *>  ****************************************************************
CPY.
(Next statement after the copy abc.cpy statement ...)

A very close look shows, that the CPY. starts in column 1 and thus should not be interpreted when also having specified the FIXED format option ...

And this leads to a parsing error as follows: Parsing file ab2600145.CBL. line 171:0 mismatched input 'CPY' expecting Collecting units in file ab2600145.CBL.

Well - I know, it is negotiable if this really is a parsing error, of course a COPY abc or a COPY 'abc.cpy' work correctly. the compilers we are using here on site, also resolve a copy abc.cpy Statement correctly => so personally I tend to say, yes it is an error.

uwol commented 6 years ago

Yes, this definitely is an error, as the preprocessor cannot parse successfully and only by pure luck is able to identify the copy book :-).

Since #43 this also should lead to an exception anyway, so I have to fix this.

uwol commented 6 years ago

Fixed in 4393a470edef8f33db4043c02166d3c5e5402320. Added a unit test.

Thanks!