feat (parser): parse empty CLASS-ID paragraph with "unimplemented" warning#284
feat (parser): parse empty CLASS-ID paragraph with "unimplemented" warning#284kmr-srbh wants to merge 2 commits intoOCamlPro:gitside-gnucobol-3.xfrom
CLASS-ID paragraph with "unimplemented" warning#284Conversation
…warning * Add support for parsing an "empty" `CLASS-ID` paragraph with no contained paragraphs and divisions. * Emit a "unimplemented" warning and exit. Signed-off-by: Saurabh Kumar <developer.saurabh@outlook.com>
|
@GitMensch @nberth could you please review? |
There was a problem hiding this comment.
Very good! One side question though (please ignore if you have discussed this with @GitMensch already): I would have though this kind of changes for OOP would target the gitside-master branch (so GnuCOBOL 4.x instead of GnuCOBOL 3.x).
|
|
||
| AT_CHECK([$COMPILE_ONLY -Wno-unfinished prog.cob], [0], [], []) | ||
| AT_CLEANUP | ||
|
|
There was a problem hiding this comment.
Minor: we typically put two empty lines below an AT_CLEANUP.
| CLASS-ID. MyClass. | ||
| END CLASS MyClass. | ||
|
|
||
| ]) |
There was a problem hiding this comment.
I think it may be worth adding additional tests here:
- One with two definitions of a class with the same name (to trigger the redefinition error);
- One where the class name that follows
END CLASSdoes not correspond to the currentCLASS-ID.
(Besides, the empty lines are not necessary in the COBOL code.)
There was a problem hiding this comment.
We are not creating the AST currently so I think we cannot check those errors now. I think throwing the above errors requires calls to setup_program() and clean_up_program(). I will make sure to add checks for these in the PR where we start with the AST. :)
Besides, the empty lines are not necessary in the COBOL code.
Done in 2907b0e.
|
@nberth the plan is to bring the syntax and possibly first AST into GC3 so its parser is not trashed when OO is fed into it - returning UNSUPPORTED, then bringing that with a merge over to master/trunk where the AST is finished (by that also the syntax checks which may be not complete in 3.x) and the codegen is implemented.
If I don't misremember, then that was also outlined in the GSoC proposal.
Thanks for the reviews, I'll get in when you feel the use of that.
Nicolas Berthier ***@***.***> schrieb am Freitag, 10. April 2026 um 16:20:
… @nberth commented on this pull request.
Very good! One side question though (please ignore if you have discussed this with @GitMensch already): I would have though this kind of support would target the `gitside-master` (so GnuCOBOL 4.x instead of GnuCOBOL 3.x).
In tests/testsuite.src/syn_definition.at:
> @@ -2947,3 +2947,19 @@ AT_DATA([prog.cob], [
AT_CHECK([$COMPILE_ONLY -Wno-unfinished prog.cob], [0], [], [])
AT_CLEANUP
+
Minor: we typically put two empty lines below an `AT_CLEANUP`.
In tests/testsuite.src/syn_definition.at:
> @@ -2947,3 +2947,19 @@ AT_DATA([prog.cob], [
AT_CHECK([$COMPILE_ONLY -Wno-unfinished prog.cob], [0], [], [])
AT_CLEANUP
+
+AT_SETUP([CLASS-ID Syntax Check])
+AT_KEYWORDS([CLASS-ID])
+
+AT_DATA([prog.cob], [
+ IDENTIFICATION DIVISION.
+
+ CLASS-ID. MyClass.
+ END CLASS MyClass.
+
+])
I think it may be worth adding additional tests here:
- One with two definitions of a class with the same name (to trigger the redefinition error);
- One where the class name that follows `END CLASS` does not correspond to the current `CLASS-ID`.
(Besides, the empty lines are not necessary in the COBOL code.)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Signed-off-by: Saurabh Kumar <developer.saurabh@outlook.com>
483d50f to
2907b0e
Compare
CLASS-IDparagraph with no contained paragraphs and divisions.