Skip to content

Commit

Permalink
fix: last defects
Browse files Browse the repository at this point in the history
  • Loading branch information
chacebot committed Jan 7, 2025
1 parent 4d3c9b2 commit 3003e56
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 19 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ DATA2 : D A T A '2';
DATABUFFERS : D A T A B U F F E R S;
DATAFORMAT : D A T A F O R M A T;
DATALENGTH : D A T A L E N G T H;
DATALENTH : D A T A L E N T H;
DATALOCATION : D A T A L O C A T I O N;
DATAONLY : D A T A O N L Y;
DATAPOINTER : D A T A P O I N T E R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ cics_ignore_options : (CONDITION | cics_conditions | cics_handle_response)+;
/** INQUIRE, Application Commands ACTIVITYID / CONTAINER / EVENT / PROCESS / TIMER */
cics_inquire: INQUIRE (cics_inquire_process | cics_inquire_activityid | cics_inquire_container | cics_inquire_event | cics_inquire_timer);
cics_inquire_activityid: ((COMPSTATUS | MODE | SUSPSTATUS) cics_cvda | (ABCODE | ABPROGRAM | ACTIVITY | EVENT | PROCESS | PROCESSTYPE | PROGRAM | TRANSID | USERID) cics_data_area | cics_handle_response)* ACTIVITYID cics_data_value ((COMPSTATUS | MODE | SUSPSTATUS) cics_cvda | (ABCODE | ABPROGRAM | ACTIVITY | EVENT | PROCESS | PROCESSTYPE | PROGRAM | TRANSID | USERID) cics_data_area | cics_handle_response)*;
cics_inquire_container: CONTAINER cics_data_value ((ACTIVITYID | PROCESS | PROCESSTYPE) cics_data_value | (DATALENTH | SET) cics_data_area | cics_handle_response)*;
cics_inquire_event: ((EVENT | ACTIVITYID) | cics_data_value | (EVENTTYPE | FIRESTATUS | PREDICATE) cics_cvda | (COMPOSITE | TIMER) cics_data_area | cics_handle_response)+;
cics_inquire_container: CONTAINER cics_data_value ((ACTIVITYID | PROCESS | PROCESSTYPE) cics_data_value | (DATALENGTH | SET) cics_data_area | cics_handle_response)*;
cics_inquire_event: EVENT cics_data_value (ACTIVITYID cics_data_value | (EVENTTYPE | FIRESTATUS | PREDICATE) cics_cvda | (COMPOSITE | TIMER) cics_data_area | cics_handle_response)*;
cics_inquire_process: PROCESS cics_data_value (PROCESSTYPE cics_data_value | ACTIVITYID cics_data_area | cics_handle_response)*;
cics_inquire_timer: TIMER cics_data_value (ACTIVITYID cics_data_value | (EVENT | ABSTIME) cics_data_area| STATUS cics_cvda | cics_handle_response)*;

Expand Down Expand Up @@ -1451,7 +1451,6 @@ ABCODE
| DATABUFFERS
| DATAFORMAT
| DATALENGTH
| DATALENTH
| DATALOCATION
| DATAONLY
| DATAPOINTER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class CICSInquireOptionsCheckUtility extends CICSOptionsCheckBaseUtility
put(CICSLexer.COMPOSITE, ErrorSeverity.ERROR);
put(CICSLexer.COMPSTATUS, ErrorSeverity.ERROR);
put(CICSLexer.CONTAINER, ErrorSeverity.ERROR);
put(CICSLexer.DATALENTH, ErrorSeverity.ERROR);
put(CICSLexer.DATALENGTH, ErrorSeverity.ERROR);
put(CICSLexer.EVENT, ErrorSeverity.ERROR);
put(CICSLexer.EVENTTYPE, ErrorSeverity.ERROR);
put(CICSLexer.FIRESTATUS, ErrorSeverity.ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.util.*;

import static org.eclipse.lsp.cobol.implicitDialects.cics.CICSParser.PSDINTERVAL;
import static org.eclipse.lsp.cobol.implicitDialects.cics.CICSParser.RULE_cics_inquire_system_programming;

/**
Expand Down Expand Up @@ -74,6 +75,7 @@ public class CICSInquireSPOptionsCheckUtility extends CICSOptionsCheckBaseUtilit
put(CICSParser.RULE_cics_inquire_uowlink, CICSParser.UOWLINK);
put(CICSParser.RULE_cics_inquire_urimap, CICSParser.URIMAP);
put(CICSParser.RULE_cics_inquire_webservice, CICSParser.WEBSERVICE);
put(CICSParser.RULE_cics_inquire_xmltransform, CICSParser.XMLTRANSFORM);

}
};
Expand Down Expand Up @@ -1692,7 +1694,7 @@ public <E extends ParserRuleContext> void checkOptions(E ctx) {
uowdsnfailContext.END(),
uowdsnfailContext.NEXT());
if (!uowdsnfailContext.START().isEmpty() || !uowdsnfailContext.END().isEmpty()) {
checkBrowsingInvalidOptions(uowdsnfailContext, CICSParser.UOW);
checkBrowsingInvalidOptions(uowdsnfailContext, CICSParser.UOWDSNFAIL);
}
break;

Expand All @@ -1705,16 +1707,19 @@ public <E extends ParserRuleContext> void checkOptions(E ctx) {
uowenqContext.START(),
uowenqContext.END(),
uowenqContext.NEXT());
checkHasMutuallyExclusiveOptions(
"ENQSCOPE or RESOURCE or UOW or END",
uowenqContext.ENQSCOPE(),
uowenqContext.RESOURCE(),
uowenqContext.UOW(),
uowenqContext.END());

if (!uowenqContext.END().isEmpty()) {
checkHasMutuallyExclusiveOptions(
"ENQSCOPE or RESOURCE or UOW or END",
uowenqContext.ENQSCOPE(),
uowenqContext.RESOURCE(),
uowenqContext.UOW(),
uowenqContext.END());
}
if (!uowenqContext.START().isEmpty() || !uowenqContext.END().isEmpty()) {
checkBrowsingInvalidOptions(
uowenqContext,
CICSParser.ENQ,
CICSParser.UOWENQ,
CICSParser.ENQSCOPE,
CICSParser.RESOURCE,
CICSParser.RESLEN,
Expand All @@ -1726,6 +1731,13 @@ public <E extends ParserRuleContext> void checkOptions(E ctx) {

break;

case CICSParser.RULE_cics_inquire_vtam:
CICSParser.Cics_inquire_vtamContext vtamContext = (CICSParser.Cics_inquire_vtamContext) ctx;
checkHasMutuallyExclusiveOptions("PSDINTHRS with PSDINTERVAL", vtamContext.PSDINTERVAL(), vtamContext.PSDINTHRS());
checkPrerequisiteIsMet(vtamContext.PSDINTHRS(), vtamContext.PSDINTMINS(), vtamContext, "PSDINTMINS without PSDINTMINS");
checkPrerequisiteIsMet(vtamContext.PSDINTMINS(), vtamContext.PSDINTSECS(), vtamContext, "PSDINTMINS without PSDINTMINS");
break;

default:
Integer ruleToken = COMMON_INQUIRE_BROWSE_RULES.get(ctx.getRuleIndex());
if (ruleToken != null) checkBrowsingCommon(ctx, ruleToken);
Expand Down
1 change: 0 additions & 1 deletion server/engine/src/main/resources/LanguageKeywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ DATABUFFERS=
DATACLAS=
DATAFORMAT=
DATALENGTH=
DATALENTH=
DATALINK=
DATALOCATION=
DATAONLY=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ public class TestCICSInquire {
private static Stream<String> getValidOptions() {
return Stream.of(
"ACTIVITYID({$varOne}) COMPSTATUS({$varOne}) MODE({$varOne}) SUSPSTATUS({$varOne}) ABCODE({$varOne}) ABPROGRAM({$varOne}) ACTIVITY({$varOne}) EVENT({$varOne}) PROCESS({$varOne}) PROCESSTYPE({$varOne}) PROGRAM({$varOne}) TRANSID({$varOne}) USERID({$varOne})",
"CONTAINER({$varOne}) PROCESS({$varOne}) PROCESSTYPE({$varOne}) DATALENTH({$varOne}) SET({$varOne})",
"CONTAINER({$varOne}) PROCESS({$varOne}) PROCESSTYPE({$varOne}) DATALENGTH({$varOne}) SET({$varOne})",
"EVENT({$varOne}) ACTIVITYID({$varOne}) EVENTTYPE({$varOne}) FIRESTATUS({$varOne}) PREDICATE({$varOne}) COMPOSITE({$varOne}) TIMER({$varOne})",
"PROCESS({$varOne}) PROCESSTYPE({$varOne}) ACTIVITYID({$varOne})",
"TIMER({$varOne}) ACTIVITYID({$varOne}) EVENT({$varOne}) ABSTIME({$varOne})");
"TIMER({$varOne}) ACTIVITYID({$varOne}) EVENT({$varOne}) ABSTIME({$varOne})",
"TIMER({$varOne})",
"EVENT({$varOne})");
}

private static final String CONTAINER_INVALID =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@ private static Stream<String> getValidOptions() {
"UOWENQ NEXT DURATION({$varOne}) ENQFAILS({$varOne}) NETUOWID({$varOne}) QUALIFIER({$varOne}) QUALLEN({$varOne}) TASKID({$varOne}) TRANSID({$varOne}) RESOURCE({$varOne}) RESLEN({$varOne}) RELATION({$varOne}) STATE({$varOne}) TYPE({$varOne})",
"UOWLINK({$varOne}) HOST({$varOne}) PORT({$varOne}) BRANCHQUAL({$varOne}) LINK({$varOne}) NETUOWID({$varOne}) RMIQFY({$varOne}) SYSID({$varOne}) UOW({$varOne}) URID({$varOne}) XID({$varOne}) PROTOCOL({$varOne}) RESYNCSTATUS({$varOne}) ROLE({$varOne}) TYPE({$varOne})",
"URIMAP({$varOne}) ATOMSERVICE({$varOne}) CERTIFICATE({$varOne}) CHANGEAGREL({$varOne}) CHANGETIME({$varOne}) CHANGEUSRID({$varOne}) CHARACTERSET({$varOne}) CIPHERS({$varOne}) CONVERTER({$varOne}) DEFINESOURCE({$varOne}) DEFINETIME({$varOne}) HFSFILE({$varOne}) HOST({$varOne}) HOSTCODEPAGE({$varOne}) INSTALLTIME({$varOne}) INSTALLUSRID({$varOne}) IPRESOLVED({$varOne}) LOCATION({$varOne}) MEDIATYPE({$varOne}) NUMCIPHERS({$varOne}) PATH({$varOne}) PIPELINE({$varOne}) PORT({$varOne}) PROGRAM({$varOne}) SOCKETCLOSE({$varOne}) SOCKPOOLSIZE({$varOne}) TCPIPSERVICE({$varOne}) TEMPLATENAME({$varOne}) TRANSACTION({$varOne}) USERID({$varOne}) WEBSERVICE({$varOne}) APPLICATION({$varOne}) APPLMAJORVER({$varOne}) APPLMINORVER({$varOne}) APPLMICROVER({$varOne}) OPERATION({$varOne}) PLATFORM({$varOne}) ANALYZERSTAT({$varOne}) AUTHENTICATE({$varOne}) AVAILSTATUS({$varOne}) CHANGEAGENT({$varOne}) ENABLESTATUS({$varOne}) HOSTTYPE({$varOne}) INSTALLAGENT({$varOne}) IPFAMILY({$varOne}) REDIRECTTYPE({$varOne}) SCHEME({$varOne}) USAGE({$varOne})",
"VTAM GRNAME({$varOne}) PSDINTERVAL({$varOne}) PSDINTHRS({$varOne}) PSDINTMINS({$varOne}) PSDINTSECS({$varOne}) GRSTATUS({$varOne}) OPENSTATUS({$varOne}) PSTYPE({$varOne})",
"VTAM GRNAME({$varOne}) PSDINTHRS({$varOne}) PSDINTMINS({$varOne}) PSDINTSECS({$varOne}) GRSTATUS({$varOne}) OPENSTATUS({$varOne}) PSTYPE({$varOne})",
"WEB GARBAGEINT({$varOne}) TIMEOUTINT({$varOne})",
"WEBSERVICE({$varOne}) ARCHIVEFILE({$varOne}) BINDING({$varOne}) CCSID({$varOne}) CHANGEAGREL({$varOne}) CHANGETIME({$varOne}) CHANGEUSRID({$varOne}) CONTAINER({$varOne}) DEFINESOURCE({$varOne}) DEFINETIME({$varOne}) ENDPOINT({$varOne}) INSTALLTIME({$varOne}) INSTALLUSRID({$varOne}) LASTMODTIME({$varOne}) MAPPINGLEVEL({$varOne}) MAPPINGRNUM({$varOne}) MAPPINGVNUM({$varOne}) MINRUNLEVEL({$varOne}) MINRUNRNUM({$varOne}) MINRUNVNUM({$varOne}) PIPELINE({$varOne}) PROGRAM({$varOne}) URIMAP({$varOne}) WSBIND({$varOne}) WSDLFILE({$varOne}) CHANGEAGENT({$varOne}) INSTALLAGENT({$varOne}) PGMINTERFACE({$varOne}) STATE({$varOne}) VALIDATIONST({$varOne}) XOPDIRECTST({$varOne}) XOPSUPPORTST({$varOne})",
"WLMHEALTH ADJUSTMENT({$varOne}) HEALTH({$varOne}) HEALTHABSTIM({$varOne}) INTERVAL({$varOne}) OPENSTATUS({$varOne})",
"XMLTRANSFORM({$varOne})BUNDLE({$varOne}) CCSID({$varOne}) MAPPINGLEVEL({$varOne}) MAPPINGRNUM({$varOne}) MAPPINGVNUM({$varOne}) MINRUNLEVEL({$varOne}) MINRUNRNUM({$varOne}) MINRUNVNUM({$varOne}) XMLSCHEMA({$varOne}) XSDBIND({$varOne}) CHANGEAGREL({$varOne}) CHANGETIME({$varOne}) CHANGEUSRID({$varOne}) DEFINESOURCE({$varOne}) DEFINETIME({$varOne}) INSTALLTIME({$varOne}) INSTALLUSRID({$varOne}) VALIDATIONST({$varOne}) CHANGEAGENT({$varOne}) ENABLESTATUS({$varOne}) INSTALLAGENT({$varOne})");
"XMLTRANSFORM({$varOne}) BUNDLE({$varOne}) CCSID({$varOne}) MAPPINGLEVEL({$varOne}) MAPPINGRNUM({$varOne}) MAPPINGVNUM({$varOne}) MINRUNLEVEL({$varOne}) MINRUNRNUM({$varOne}) MINRUNVNUM({$varOne}) XMLSCHEMA({$varOne}) XSDBIND({$varOne}) CHANGEAGREL({$varOne}) CHANGETIME({$varOne}) CHANGEUSRID({$varOne}) DEFINESOURCE({$varOne}) DEFINETIME({$varOne}) INSTALLTIME({$varOne}) INSTALLUSRID({$varOne}) VALIDATIONST({$varOne}) CHANGEAGENT({$varOne}) ENABLESTATUS({$varOne}) INSTALLAGENT({$varOne})",
"UOWENQ NEXT ENQSCOPE({$varOne}) RESOURCE({$varOne}) RESLEN({$varOne}) UOW({$varOne})",
"UOWENQ START",
"UOWDSNFAIL START");
}

private static final String INVALID_BROWSE_BRFACILITY =
Expand Down Expand Up @@ -241,6 +244,48 @@ private static Stream<String> getValidOptions() {

private static final String SECDISCOVERY_VALID = "INQUIRE SECDISCOVERY STATUS({$varOne}) LASTSECDTIME({$varOne})";

private static final String XMLTRANS_INVALID = "INQUIRE {XMLTRANSFORM|errorOne}";

private static final String VTAM_INVALID = "INQUIRE VTAM {PSDINTERVAL|errorOne}(1) {PSDINTHRS|errorTwo}(1) PSDINTMINS(1) PSDINTSECS(1)";

@Test
void testInvalidVTAM() {
Map<String, Diagnostic> expectedDiagnostics =
ImmutableMap.of(
"errorOne",
new Diagnostic(
new Range(),
"Exactly one option required, options are mutually exclusive: PSDINTHRS with PSDINTERVAL",
DiagnosticSeverity.Error,
ErrorSource.PARSING.getText()),
"errorTwo",
new Diagnostic(
new Range(),
"Exactly one option required, options are mutually exclusive: PSDINTHRS with PSDINTERVAL",
DiagnosticSeverity.Error,
ErrorSource.PARSING.getText()),
"errorThree",
new Diagnostic(
new Range(),
"Invalid option or parameter provided: Missing required option parameter",
DiagnosticSeverity.Error,
ErrorSource.PARSING.getText()));
CICSTestUtils.errorTest(VTAM_INVALID, expectedDiagnostics, "SP");
}

@Test
void testInvalidXMLTrans() {
Map<String, Diagnostic> expectedDiagnostics =
ImmutableMap.of(
"errorOne",
new Diagnostic(
new Range(),
"Invalid option or parameter provided: Missing required option parameter",
DiagnosticSeverity.Error,
ErrorSource.PARSING.getText()));
CICSTestUtils.errorTest(XMLTRANS_INVALID, expectedDiagnostics, "SP");
}

@Test
void testLastSecD() {
CICSTestUtils.noErrorTest(SECDISCOVERY_VALID, "SP");
Expand Down

0 comments on commit 3003e56

Please sign in to comment.