uwol / proleap-cobol-parser

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

proleap parse issue - Microfocus Dialect #73

Open chrisfw opened 5 years ago

chrisfw commented 5 years ago

Hello, I am experiencing issues attempting to parse the attached COBOL program (using the Microfocus dialect). The parser reports the errors below although the program compiles with no errors in Microfocus COBOL (both Server Express and Visual COBOL). Any information you can provide would be greatly appreciated.

Thanks,

Chris Whelan

12:41:40.618 [main] INFO io.proleap.cobol.asg.runner.impl.CobolParserRunnerImpl - Parsing file csachca.cbl. line 23:15 extraneous input 'status' expecting {ABORT, AS, ASCII, ASSOCIATED_DATA, ASSOCIATED_DATA_LENGTH, ATTRIBUTE, AUTO, AUTO_SKIP, BACKGROUND_COLOR, BACKGROUND_COLOUR, BEEP, BELL, BINARY, BIT, BLINK, BLOB, BOUNDS, CAPABLE, CCSVERSION, CHANGED, CHANNEL, CLOB, CLOSE_DISPOSITION, COBOL, COMMITMENT, CONTROL_POINT, CONVENTION, CRUNCH, CURSOR, DBCLOB, DEFAULT, DEFAULT_DISPLAY, DEFINITION, DFHRESP, DFHVALUE, DISK, DONTCARE, DOUBLE, EBCDIC, EMPTY_CHECK, ENTER, ENTRY_PROCEDURE, ERASE, EOL, EOS, ESCAPE, EVENT, EXCLUSIVE, EXPORT, EXTENDED, FOREGROUND_COLOR, FOREGROUND_COLOUR, FULL, FUNCTIONNAME, FUNCTION_POINTER, GRID, HIGHLIGHT, IMPLICIT, IMPORT, INTEGER, IS, KEPT, KEYBOARD, LANGUAGE, LB, LD, LEFTLINE, LENGTH_CHECK, LIBACCESS, LIBPARAMETER, LIBRARY, LIST, LOCAL, LONG_DATE, LONG_TIME, LOWER, LOWLIGHT, MMDDYYYY, NAMED, NATIONAL, NATIONAL_EDITED, NETWORK, NO_ECHO, NUMERIC_DATE, NUMERIC_TIME, ODT, ORDERLY, OVERLINE, OWN, PASSWORD, PORT, PRINTER, PRIVATE, PROCESS, PROGRAM, PROMPT, READER, REMOTE, REAL, RECEIVED, RECURSIVE, REF, REMOVE, REQUIRED, REVERSE_VIDEO, SAVE, SECURE, SHARED, SHAREDBYALL, SHAREDBYRUNUNIT, SHARING, SHORT_DATE, SQL, SYMBOL, TASK, THREAD, THREAD_LOCAL, TIMER, TODAYS_DATE, TODAYS_NAME, TRUNCATED, TYPEDEF, UNDERLINE, VIRTUAL, WAIT, YEAR, YYYYMMDD, YYYYDDD, ZERO_FILL, IDENTIFIER} line 56:15 extraneous input 'LOCK' expecting {SELECT, DOT_FS} line 81:15 extraneous input 'LOCK' expecting {SELECT, DOT_FS} line 5739:63 extraneous input '.' expecting {ABORT, ALIGNED, ALL, AS, ASCII, ASSOCIATED_DATA, ASSOCIATED_DATA_LENGTH, ATTRIBUTE, AUTO, AUTO_SKIP, BACKGROUND_COLOR, BACKGROUND_COLOUR, BEEP, BELL, BINARY, BIT, BLANK, BLINK, BLOB, BOUNDS, BY, CAPABLE, CCSVERSION, CHANGED, CHANNEL, CLOB, CLOSE_DISPOSITION, COBOL, COMMITMENT, COMMON, COMP, COMP_1, COMP_2, COMP_3, COMP_4, COMP_5, COMPUTATIONAL, COMPUTATIONAL_1, COMPUTATIONAL_2, COMPUTATIONAL_3, COMPUTATIONAL_4, COMPUTATIONAL_5, CONTENT, CONTROL_POINT, CONVENTION, CRUNCH, CURSOR, DATE, DBCLOB, DEFAULT, DEFAULT_DISPLAY, DEFINITION, DFHRESP, DFHVALUE, DISK, DISPLAY, DISPLAY_1, DONTCARE, DOUBLE, EBCDIC, EMPTY_CHECK, ENTER, ENTRY_PROCEDURE, ERASE, EOL, EOS, ESCAPE, EVENT, EXCLUSIVE, EXPORT, EXTENDED, EXTERNAL, FALSE, FOREGROUND_COLOR, FOREGROUND_COLOUR, FULL, FUNCTIONNAME, FUNCTION_POINTER, GLOBAL, GRID, HIGHLIGHT, HIGH_VALUE, HIGH_VALUES, IMPLICIT, IMPORT, INDEX, INTEGER, IS, JUST, JUSTIFIED, KANJI, KEPT, KEYBOARD, LANGUAGE, LB, LD, LEADING, LEFTLINE, LENGTH_CHECK, LIBACCESS, LIBPARAMETER, LIBRARY, LIST, LOCAL, LOCK, LONG_DATE, LONG_TIME, LOWER, LOWLIGHT, LOW_VALUE, LOW_VALUES, MMDDYYYY, NAMED, NATIONAL, NATIONAL_EDITED, NETWORK, NO_ECHO, NULL, NULLS, NUMERIC_DATE, NUMERIC_TIME, OCCURS, ODT, ORDERLY, OVERLINE, OWN, PACKED_DECIMAL, PASSWORD, PIC, PICTURE, POINTER, PORT, PRINTER, PRIVATE, PROCEDURE_POINTER, PROCESS, PROGRAM, PROMPT, QUOTE, QUOTES, READER, REMOTE, REAL, RECEIVED, RECORD, RECURSIVE, REDEFINES, REF, REFERENCE, REMOVE, REQUIRED, REVERSE_VIDEO, SAVE, SECURE, SHARED, SHAREDBYALL, SHAREDBYRUNUNIT, SHARING, SHORT_DATE, SIGN, SPACE, SPACES, SQL, STRING, SYMBOL, SYNC, SYNCHRONIZED, TASK, THREAD, THREAD_LOCAL, TIMER, TODAYS_DATE, TODAYS_NAME, TRAILING, TRUE, TRUNCATED, TYPE, TYPEDEF, UNDERLINE, USAGE, USING, VALUE, VALUES, VIRTUAL, WAIT, WITH, YEAR, YYYYMMDD, YYYYDDD, ZERO, ZERO_FILL, ZEROS, ZEROES, DOT_FS, NONNUMERICLITERAL, '66', '77', '88', INTEGERLITERAL, NUMERICLITERAL, IDENTIFIER} line 10187:43 no viable alternative at input 'MOVE "Record Locked Out" TO HDATA(1)\n MOVE "Wait Until Other Operator" TO HDATA(2)\n MOVE "Has Finished With This Record" TO HDATA(3)\n MOVE "And Try Again" TO HDATA(4)\n *> * PERFORM VARYING NUMBER-SUBDIV-RANGE FROM 1 BY 1\n > UNTIL HVD-SQL-TEXT(NUMBER-SUBDIV-RANGE:4) = "FROM"\n *> * END-PERFORM\n > COMPUTE NUMBER-SUBDIV-RANGE = NUMBER-SUBDIV-RANGE + 5\n >EXECSQL EXEC SQL\n >EXECSQL SELECT esql.getTablenames(sqlid) tables\n >EXECSQL INTO :SAVE-A-KEY FROM enqsql WHERE sqlid = :HVD-SQLID\n >EXECSQL END-EXEC }\n STRING "Table Name : "\n SAVE-A-KEY\n DELIMITED BY " "\n INTO HDATA(5)\n STRING "SQL ID : " HVD-SQLID INTO' line 10186:25 extraneous input '(' expecting {ACCEPT, ADD, ALTER, CALL, CANCEL, CLOSE, COMPUTE, CONTINUE, DELETE, DISABLE, DISPLAY, DIVIDE, ENABLE, ENTRY, EVALUATE, EXHIBIT, EXIT, GENERATE, GOBACK, GO, IF, INITIALIZE, INITIATE, INSPECT, MERGE, MOVE, MULTIPLY, NEXT, OPEN, PERFORM, PURGE, READ, RECEIVE, RELEASE, RETURN, REWRITE, SEARCH, SEND, SET, SORT, START, STOP, STRING, SUBTRACT, TERMINATE, UNSTRING, WRITE, DOT_FS, EXECCICSLINE, EXECSQLIMSLINE, EXECSQLLINE} line 10186:27 mismatched input ')' expecting

csachca.zip

Reinhard-Prehofer commented 5 years ago

Hi Chris! If you have a look at the underlying Cobol.g4 grammar, you will find the definition of the fileControlClause as follows in antLR: fileControlClause : assignClause | reserveClause | organizationClause | paddingCharacterClause | recordDelimiterClause | accessModeClause | recordKeyClause | alternateRecordKeyClause | fileStatusClause | passwordClause | relativeKeyClause

Obviously the "LOCK MODE CLAUSE" has not yet been implemented in the grammar. Thats also the reason for the parsing errors like _"line 56:15 extraneous input 'LOCK' expecting {SELECT, DOTFS}" For the time being I could only recommend you to comment out these LOCK Clauses in your Cobol program. rgds, Reinhard

chrisfw commented 5 years ago

Thank you for following up Reinhard. Is there anything planned in the project roadmap to enhance the grammar implementation with this and other unimplemented Microfocus features?

On Dec 28, 2018, at 11:17 AM, Reinhard Prehofer notifications@github.com wrote:

Hi Chris! If you have a look at the underlying Cobol.g4 grammar, you will find the definition of the fileControlClause as follows in antLR: fileControlClause : assignClause | reserveClause | organizationClause | paddingCharacterClause | recordDelimiterClause | accessModeClause | recordKeyClause | alternateRecordKeyClause | fileStatusClause | passwordClause | relativeKeyClause

Obviously the "LOCK MODE CLAUSE" has not yet been implemented in the grammar. Thats also the reason for the parsing errors like "line 56:15 extraneous input 'LOCK' expecting {SELECT, DOT_FS}" For the time being I could only recommend you to comment out these LOCK Clauses in your Cobol program. rgds, Reinhard

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

uwol commented 5 years ago

Hello Chris,

correct, support for Microfocus dialect is limited in the current version.

We are evaluating to add support for Microfocus, as this was the top requested feature in 2018! However, we have to take into account time and budget constraints, so we have to do this further development of the open-source components as a by-product of a billable project setup.

Best regards Ulrich

chrisfw commented 5 years ago

Good to hear there may be additional support for Microfocus coming in 2019. Thanks Ulrich - Happy New Year!

On Dec 31, 2018, at 11:24 AM, Ulrich Wolffgang notifications@github.com wrote:

Hello Chris,

correct, support for Microfocus dialect is limited in the current version.

We are evaluating to add support for Microfocus, as this was the top requested feature in 2018! However, we have to take into account time and budget constraints, so we have to do this further development of the open-source components as a by-product of a billable project setup.

Best regards Ulrich

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.