uwol / proleap-cobol-parser

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

Unstringing indexed items not recognized correctly #18

Closed Reinhard-Prehofer closed 6 years ago

Reinhard-Prehofer commented 7 years ago

Unstringing an indexed item - like t-wert (x-1) is not parsed correctly. Using a simple item - like z-wert in out example - works

005270*        UNSTRING Z-WERT                                          Y2612893
005270         UNSTRING T-WERT  (X-1)                                   Y2612893
005280                 DELIMITED BY ALL '='                             Y2612893
005290                           OR ALL '  '                            Y2612893
005300                 INTO         Z-WERT1                             Y2612893
005310                              Z-WERT2                             Y2612893
005320         END-UNSTRING                                             Y2612893

parsing errors are following. The Error starts with the left parenthesis of the index ... UnstringSample.cbl.txt

line 89:32 mismatched input '(' expecting INTO
line 89:36 mismatched input ')' expecting SECTION
line 93:36 mismatched input 'Z-WERT2' expecting SECTION
line 94:15 mismatched input 'END-UNSTRING' expecting SECTION
line 96:29 mismatched input '=' expecting SECTION
line 97:43 mismatched input 'TO' expecting SECTION
line 98:15 mismatched input 'WHEN' expecting SECTION
line 98:29 mismatched input '=' expecting SECTION
line 99:43 mismatched input 'TO' expecting SECTION
line 100:15 mismatched input 'WHEN' expecting SECTION
line 100:29 mismatched input '=' expecting SECTION
line 101:43 mismatched input 'TO' expecting SECTION
line 102:15 mismatched input 'WHEN' expecting SECTION
line 102:29 mismatched input '=' expecting SECTION
line 103:43 mismatched input 'TO' expecting SECTION
line 104:15 mismatched input 'WHEN' expecting SECTION
line 104:29 mismatched input '=' expecting SECTION
line 105:43 mismatched input 'TO' expecting SECTION
line 106:15 mismatched input 'WHEN' expecting SECTION
line 106:29 mismatched input '=' expecting SECTION
line 107:43 mismatched input 'TO' expecting SECTION
line 108:15 mismatched input 'WHEN' expecting SECTION
line 108:29 mismatched input '=' expecting SECTION
line 109:43 mismatched input 'TO' expecting SECTION
line 110:15 mismatched input 'WHEN' expecting SECTION
line 110:29 mismatched input '=' expecting SECTION
line 111:43 mismatched input 'TO' expecting SECTION
line 112:15 mismatched input 'WHEN' expecting SECTION
uwol commented 6 years ago

OK, fixed that bug in b35f76f702bd0ddb689ec76426ca29a0d0c9c40e and included the example provided by you as a unit test.

Thanks!