Closed AkashKumar7902 closed 1 year ago
Hi @AkashKumar7902 Thank you for the pull request. I am not sure that the pull request solves the issue. I am aware that the example in the issue only lists a perform statement inside the ON EXCEPTION clause. But any COBOL statement is valid inside the ON EXCEPTION clause, there can be multiple lines, and even a new CALL with its own ON EXCEPTION clause.
And please add tests that verifies that the changes fixes the issue.
Regards, Rune
@Rune-Christensen Thanks for the clarification.
Here is my another idea:
In the endOfStatement
function, if the current line contains CALL
verb then it will continue returning false until it finds an equal number of END-CALL
verb as CALL
verb in the current line or if it encounters a terminating verb in the next line.
Here is a list of terminating verbs. Please Suggest addition/deletion(s) if any.
GO
GOBACK
STOP
EXIT
END
I would love to have feedback on this approach.
Hi @AkashKumar7902 I am afraid that will also not work. The issue is that in this code: CALL "A" USING A-VALUES MOVE "SOME-VALUE" TO B-VALUES The MOVE statement is the statement that indicates that the CALL statement is finished.
You have to identify the ON EXCEPTION phrase, and then look for a END-CALL or a period >>.<< as the keys to determine when the CALL is finished.
Also "terminating" verbs, doesn't work like that. This is invalid COBOL: CALL "A" USING A-VALUES ON EXCEPTION GOBACK A-NEW-PARAGRAPH.
You will get a compile error, because the CALL ON EXCEPTION statement is not finished, before the next paragraph definition. Terminating verbs still have to be inside valid COBOL, and have to be encapsulated by END-CALL END-IF and so on statements.
You should not be considering terminating verbs in the code you are building for this, they are just as any other COBOL statements in this regard.
Regards Rune
@Rune-Christensen Thanks for the review. I will be sending a new PR.
Fixes: #276