-
Notifications
You must be signed in to change notification settings - Fork 57
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
base: development
Are you sure you want to change the base?
Cics web command fix v2 #2469
Conversation
8083031
to
9185bf1
Compare
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.
a94c878
to
79330b8
Compare
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.
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.
@slavek-kucera Would it be possible for you to review this? |
server/engine/src/main/antlr4/org/eclipse/lsp/cobol/implicitDialects/cics/CICSParser.g4
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSOptionsCheckBaseUtility.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSOptionsCheckBaseUtility.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
if (ParserRuleContext.class.isAssignableFrom(rule.getClass())) { | ||
if (!((ParserRuleContext) rule).isEmpty()) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that the isEmpty
does what you think.
https://github.com/antlr/antlr4/blob/933c4e0a0d4d5accfc2f9fa416e2c0558b4512e0/runtime/Java/src/org/antlr/v4/runtime/RuleContext.java#L100
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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".
...in/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSOptionsCheckBaseUtility.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSOptionsCheckBaseUtility.java
Outdated
Show resolved
Hide resolved
...in/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSOptionsCheckBaseUtility.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/lsp/cobol/implicitDialects/cics/utility/CICSWebOptionsCheckUtility.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
void testReadInvalid() { |
There was a problem hiding this comment.
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.
server/engine/src/main/antlr4/org/eclipse/lsp/cobol/implicitDialects/cics/CICSParser.g4
Outdated
Show resolved
Hide resolved
Remove that function as checkPrerequisiteIsMet covers the same purpose with less overhead from the developer.
Add check for lists in checkMutuallyExclusiveOptions, only count them once per iteration. Set a boolean to denote if the current "rule" being checked is a list and if so, grab the first relevant entry to use for retrieving the locality.
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: