uwol / proleap-cobol-parser

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

performVaryingPhrase accepts a literal where it should accept an indexName #103

Open wfahle opened 6 months ago

wfahle commented 6 months ago

performVaryingPhrase : (identifier | literal) performFrom performBy performUntil ;

is only used in the following contexts: performVaryingClause : VARYING performVaryingPhrase performAfter* ; and performAfter : AFTER performVaryingPhrase ;

which in both cases accepts only a literal. It makes no sense semantically to say : PERFORM PARA VARYING 1 BY 1 UNTIL 1=3 or anything like that, and the AFTER semantics is similar, providing an outer loop variable to vary. See for example: https://www.ibm.com/docs/en/cobol-zos/6.2?topic=identifiers-varying-three

The grammar should instead read: performVaryingPhrase : (identifier | indexName) performFrom performBy performUntil ; with the rest unaltered.