uwol / proleap-cobol-parser

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

Alternative way to include copy books #55

Open albertolovato opened 6 years ago

albertolovato commented 6 years ago

In code I'm parsing some copy books are included with EXEC SQL INCLUDE <copybook> END-EXEC instead of COPY <copybook>.

albertolovato commented 6 years ago

Would it be sufficient to modify the copyStatement definition as follows?

copyStatement : COPY copySource (NEWLINE* (directoryPhrase | familyPhrase | replacingPhrase | SUPPRESS))* NEWLINE* DOT | EXEC SQL INCLUDE copySource END_EXEC NEWLINE* DOT? ; INCLUDE: I N C L U D E;

uwol commented 6 years ago

Yes, that could be an option. The complicated thing with EXEC SQL INCLUDE is to get right, where COBOL ends and SQL begins. I'll have to take a look for that, so that we don't mix COBOL parsing with SQL parsing. I suspect, it belongs to COBOL...

We're having a deadline this week, I'll take a look afterwards.