Skip to content

feat (parser): parse empty CLASS-ID paragraph with "unimplemented" warning#284

Open
kmr-srbh wants to merge 2 commits intoOCamlPro:gitside-gnucobol-3.xfrom
kmr-srbh:class-id-syntax-test
Open

feat (parser): parse empty CLASS-ID paragraph with "unimplemented" warning#284
kmr-srbh wants to merge 2 commits intoOCamlPro:gitside-gnucobol-3.xfrom
kmr-srbh:class-id-syntax-test

Conversation

@kmr-srbh
Copy link
Copy Markdown

@kmr-srbh kmr-srbh commented Apr 8, 2026

  • Add support for parsing an "empty" CLASS-ID paragraph with no contained paragraphs and divisions.
  • Emit a "unimplemented" warning and exit.

…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>
@kmr-srbh
Copy link
Copy Markdown
Author

kmr-srbh commented Apr 9, 2026

@GitMensch @nberth could you please review?

Copy link
Copy Markdown
Contributor

@nberth nberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: we typically put two empty lines below an AT_CLEANUP.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2907b0e.

CLASS-ID. MyClass.
END CLASS MyClass.

])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Copy link
Copy Markdown
Author

@kmr-srbh kmr-srbh Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@GitMensch
Copy link
Copy Markdown
Collaborator

GitMensch commented Apr 10, 2026 via email

Signed-off-by: Saurabh Kumar <developer.saurabh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants