Skip to content

Commit

Permalink
Make grammar flexible, add checks, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-broadcom committed Jan 15, 2025
1 parent 7588b46 commit a077783
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ cics_purge: PURGE cics_handle_response? MESSAGE cics_handle_response?;
cics_push: PUSH cics_handle_response? HANDLE cics_handle_response?;

/** PUT CONTAINER (both of them): */
cics_put_container: ((PUT CONTAINER cics_data_value cics_put_container_bts) | (PUT|PUT64) CONTAINER cics_data_value cics_put_container_channel);
cics_put_container_bts: ((ACQACTIVITY | PROCESS | ACQPROCESS) | (ACTIVITY | FLENGTH) cics_data_value | (FROM) cics_data_area | cics_handle_response)+;
cics_put_container_channel: ((BIT | CHAR | APPEND | PREPEND) | (CHANNEL | FLENGTH | FROMCCSID | FROMCODEPAGE) cics_data_value | FROM cics_data_area | DATATYPE cics_cvda | cics_handle_response)+;
cics_put_container: (PUT cics_put_container_bts | (PUT|PUT64) cics_put_container_channel);
cics_put_container_bts: ((ACQACTIVITY | PROCESS | ACQPROCESS) | (ACTIVITY | CONTAINER | FLENGTH) cics_data_value | FROM cics_data_area | cics_handle_response)+;
cics_put_container_channel: ((BIT | CHAR | APPEND | PREPEND) | (CHANNEL | CONTAINER | FLENGTH | FROMCCSID | FROMCODEPAGE) cics_data_value | FROM cics_data_area | DATATYPE cics_cvda | cics_handle_response)+;

/** QUERY CHANNEL / COUNTER / DCOUNTER / SECURITY */
cics_query: QUERY (cics_query_channel | cics_query_counter | cics_query_security);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class CICSPutContainerOptionsCheckUtility extends CICSOptionsCheckBaseUti
private static final Map<Integer, ErrorSeverity> DUPLICATE_CHECK_OPTIONS =
new HashMap<Integer, ErrorSeverity>() {
{
put(CICSLexer.ACQACTIVITY, ErrorSeverity.ERROR);
put(CICSLexer.ACTIVITY, ErrorSeverity.ERROR);
put(CICSLexer.CHANNEL, ErrorSeverity.ERROR);
put(CICSLexer.CONTAINER, ErrorSeverity.ERROR);
Expand All @@ -43,6 +42,7 @@ public class CICSPutContainerOptionsCheckUtility extends CICSOptionsCheckBaseUti
put(CICSLexer.FROMCCSID, ErrorSeverity.ERROR);
put(CICSLexer.FROMCODEPAGE, ErrorSeverity.ERROR);

put(CICSLexer.ACQACTIVITY, ErrorSeverity.WARNING);
put(CICSLexer.ACQPROCESS, ErrorSeverity.WARNING);
put(CICSLexer.APPEND, ErrorSeverity.WARNING);
put(CICSLexer.BIT, ErrorSeverity.WARNING);
Expand Down Expand Up @@ -79,6 +79,7 @@ public <E extends ParserRuleContext> void checkOptions(E ctx) {
private void checkBTS(CICSParser.Cics_put_container_btsContext ctx) {
checkMutuallyExclusiveOptions("ACTIVITY, ACQACTIVITY, PROCESS or ACQPROCESS", ctx.ACTIVITY(), ctx.ACQACTIVITY(), ctx.PROCESS(), ctx.ACQPROCESS());
checkHasMandatoryOptions(ctx.FROM(), ctx, "FROM");
checkHasMandatoryOptions(ctx.CONTAINER(), ctx, "CONTAINER");
}

private void checkChannel(CICSParser.Cics_put_container_channelContext ctx) {
Expand All @@ -88,6 +89,7 @@ private void checkChannel(CICSParser.Cics_put_container_channelContext ctx) {
checkMutuallyExclusiveOptions("APPEND or PREPEND", ctx.APPEND(), ctx.PREPEND());

checkHasMandatoryOptions(ctx.FROM(), ctx, "FROM");
checkHasMandatoryOptions(ctx.CONTAINER(), ctx, "CONTAINER");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class TestCicsPutContainerStatement {

private static final String PUT_BTS_INVALID = "PUT CONTAINER({$varOne}) ACTIVITY({$varOne}) {ACQACTIVITY|errorOne} FROM({$varOne}) FLENGTH({$varOne})";
private static final String PUT_CHANNEL_INVALID = "PUT CONTAINER({$varOne}) CHANNEL({$varOne}) FROM({$varOne}) FLENGTH({$varOne}) BIT {DATATYPE|errorOne}({$varOne}) APPEND";
private static final String PUT_BTS_INVALID_2 = "PUT CONTAINER({$varOne}) {ACQACTIVITY|errorOne}";
private static final String PUT_BTS_INVALID_2 = "PUT {_CONTAINER({$varOne}) ACQACTIVITY|errorOne_}";

// Test Functions
@Test
Expand Down

0 comments on commit a077783

Please sign in to comment.