uwol / proleap-cobol-parser

ProLeap ANTLR4-based parser for COBOL
MIT License
137 stars 76 forks source link

Problems with continuation lines without consecutive quotation marks #80

Open No77 opened 4 years ago

No77 commented 4 years ago

CobolLineIndicatorProcessorImpl does not seem to properly take into account the case of missing consecutive quotation marks. if (trimmedContentArea.startsWith("\"") || trimmedContentArea.startsWith("'")) does also apply for non-compliant parsers starting the continuation line with only a single quotation mark. I ported your Implementation to C# for parsing Cobol for my master thesis so I am not exactly sure if the problem also applies to Java, but it looks that way.

The CobolParser is not able to parse preprocessed files containing Cobol like the following:

       STRING
           "...long string..."
  -        "...long string..."
            INTO identifier
       END-STRING

A simple if (trimmedContentArea.startsWith("\"\"") || trimmedContentArea.startsWith("''")) fixed the problem for me.