uwol / proleap-cobol-parser

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

Suppress Option in COPY-Statement not supported. #15

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 7 years ago

Referring to http://www.cs.vu.nl/grammarware/vs-cobol-ii/#gdef:copy-statement or https://www.ibm.com/support/knowledgecenter/en/SSXJAJ_13.1.0/com.ibm.faultanalyzer.doc_13.1/cblsupp.html

Legacy code tends to have COPY-statements with the SUPPRESS Option (to avoid "long listings")

001900     COPY V0P172                                                  supr2.99
001910                   REPLACING ==V0P172.== BY                       24.02.99
001920                             ==V0P172 EXTERNAL.==.                24.02.99
001930     COPY V0P172   SUPPRESS                                       24.02.99
001940                   REPLACING ==V0P172.== BY                       24.02.99
001950                             ==V0P172-DST.==.                     24.02.99

The SUPPRESS Verb is not recognized. If the "SUPPRESS" ist replaced by spaces within the source code, the error disappears.

Currently the Parser runs into the following error: Exception in thread "main" java.lang.RuntimeException: syntax error in line 193:33 missing '.' at '\n' at io.proleap.cobol.preprocessor.sub.document.impl.ThrowingErrorListener.syntaxError(ThrowingErrorListener.java:20) at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) at org.antlr.v4.runtime.DefaultErrorStrategy.reportMissingToken(DefaultErrorStrategy.java:381) at org.antlr.v4.runtime.DefaultErrorStrategy.singleTokenInsertion(DefaultErrorStrategy.java:484) at org.antlr.v4.runtime.DefaultErrorStrategy.recoverInline(DefaultErrorStrategy.java:448) at org.antlr.v4.runtime.Parser.match(Parser.java:206) at io.proleap.cobol.Cobol85PreprocessorParser.copyStatement(Cobol85PreprocessorParser.java:577) at io.proleap.cobol.Cobol85PreprocessorParser.startRule(Cobol85PreprocessorParser.java:186) at io.proleap.cobol.preprocessor.sub.document.impl.CobolDocumentParserImpl.processWithParser(CobolDocumentParserImpl.java:85) at io.proleap.cobol.preprocessor.sub.document.impl.CobolDocumentParserImpl.processLines(CobolDocumentParserImpl.java:61) at io.proleap.cobol.preprocessor.impl.CobolPreprocessorImpl.parseDocument(CobolPreprocessorImpl.java:58) at io.proleap.cobol.preprocessor.impl.CobolPreprocessorImpl.process(CobolPreprocessorImpl.java:101) at io.proleap.cobol.preprocessor.impl.CobolPreprocessorImpl.process(CobolPreprocessorImpl.java:86) at io.proleap.cobol.asg.runner.impl.CobolParserRunnerImpl.parseFile(CobolParserRunnerImpl.java:174) at io.proleap.cobol.asg.runner.impl.CobolParserRunnerImpl.analyzeFile(CobolParserRunnerImpl.java:91) at cobol.log.CobolParseDVZ.main(CobolParseDVZ.java:45)

uwol commented 6 years ago

Thanks, that's another bug. Fixed in 8a31c649f9eebd831c8d4484b5b50662c051b42f, added a unit test.