Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cics web command fix v2 #2469

Open
wants to merge 45 commits into
base: development
Choose a base branch
from

Conversation

mm-broadcom
Copy link
Contributor

Implementation of IBM's grammar for the WEB CICS command such that fulfills all of those requirements but is flexible enough for what the compiler accepts.

Here is the V1 Branch for reference. (Due to the amount of time between creation, merge/updates from Development and such, it was easier to make a new branch and port those over rather than shoehorn it in.)

How Has This Been Tested?

Wrote tests with example calls based upon IBM's documentation.

Checklist:

  • Each of my commits contains one meaningful change
  • I have performed rebase of my branch on top of the development
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked my code and corrected any misspellings

@mm-broadcom mm-broadcom marked this pull request as draft September 9, 2024 19:15
Copied the changes from the V1 branch to this one. (Too many commits and conflicts to rebase easily.)
Fixed an existing test as it was using a token/command CHARACTERSET which did not exist in the CICS Receive rule for Clients. Added some more flexibility to the new rules as well.
Initial outline of checks for WEB's commands. Committing to save changes so far.
Added a function to check for mutually exclusive rules.
More utility functions and overloads.
Added more WEB command rule verification, and fixes/consolidation of rules as well to correspond with the new checks.
@mm-broadcom mm-broadcom marked this pull request as ready for review September 18, 2024 14:26
Allow cics_handle_response to be mixed in with each of the WEB command subtypes.
Only get the first word if prior rule seen. Avoids a lot of overhead in the case of a ParserRuleContext.
Due to how expansive and computationally expensive the .getText() call on a Parser Rule Context could be, it was removed. The list of options along with the context thereof _should_ provide enough information as to where the error is.
@mm-broadcom mm-broadcom mentioned this pull request Sep 23, 2024
8 tasks
Change the multitude of if-else statements into a switch statement using the rule's index as the basis to go off of. This uses a primitive type rather than blindly asking every possible class if it is it.
Added complete duplicate checking for WEB commands.
Change to <Integer, ErrorSeverity> vs <String, ErrorSeverity>
Fixed checkHasRequired functions and overloads.
@mm-broadcom
Copy link
Contributor Author

@slavek-kucera Would it be possible for you to review this?

}

if (ParserRuleContext.class.isAssignableFrom(rule.getClass())) {
if (!((ParserRuleContext) rule).isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is also always true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not always, we care if there is content not that the current element in the list/collection is of a given type.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is exactly why I call isEmpty as it checks to see if a given RuleContext or derivative thereof has been called within the given instance of the rule.

The purpose of this function is to take a collection of possible tokens and/or rules and see if more than one has been called. If so, insert an exception/warning message into the LSP at the given context to inform the user accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

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

  • this expression will be always true
  • neither of the top level conditions are true - rules is a generally "list of lists".

}

@Test
void testReadInvalid() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a few more tests to covert the error cases.

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.

2 participants