uwol / proleap-cobol-parser

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

retain Inputformat whilst preprocessing #24

Open Reinhard-Prehofer opened 7 years ago

Reinhard-Prehofer commented 7 years ago

Preprocessing the Cobolsources in the next code snippet created correct Cobol, however only in FREE Format. This is no problem with GnuCobol, just use the -free option for further compilation of the generated Coboloutput. However, if you would like to rerun the preprocessed Coboloutput on the host, you can only use a FIXED format here. (one of the reason for rerunning that output on the host would be cobol source instrumentation or enhancements to be applied ...) Best implementation would be, that the preprocessed String returned is formatted according to the given input.

            CobolPreprocessor.CobolSourceFormatEnum format = CobolPreprocessor.CobolSourceFormatEnum.FIXED;
            String preProcessedInput = new CobolPreprocessorImpl().process(inputFile, copyBookFiles,format);