uwol / proleap-cobol-parser

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

Too rigid interpretation of FIXED line format #16

Closed Reinhard-Prehofer closed 7 years ago

Reinhard-Prehofer commented 7 years ago

In parsing an original (host) COPY-Book, I run into the following error:

Exception in thread "main" java.lang.RuntimeException: Is FIXED the correct line format? Could not parse line 80: 007200
    at io.proleap.cobol.preprocessor.sub.line.reader.impl.CobolLineReaderImpl.parseLine(CobolLineReaderImpl.java:64)

A close look at that line 80 inside the copy book shows, that in fact this line 80 is a more or less empty line, having entries in col1-6 only, then being followed by CR/LF ... so not padded up to 80 characters till column 80.

007100        10 P321-FILLER       PIC X(36).                           26.10.94
007200
007300     05 FILLER REDEFINES P321-LISTINFO.                           26.10.94

in changing the CPY-book and padding it up to 80 characters (or of course deleting the empty line), we get past the error. The parser should recognize such "empty lines" without throwing an error; maybe a warning, but not stopping the parsing process!

uwol commented 7 years ago

should be fixed in https://github.com/uwol/cobol85parser/commit/f64141a41a7153723e0162d2a392bec9579f3355.