diff --git a/che-che4z-lsp-for-cobol-integration b/che-che4z-lsp-for-cobol-integration index 642a44a3..f2691694 160000 --- a/che-che4z-lsp-for-cobol-integration +++ b/che-che4z-lsp-for-cobol-integration @@ -1 +1 @@ -Subproject commit 642a44a310fc49201fd0e9e3ccbd05ea26686380 +Subproject commit f2691694a819bfa3c12672fda704900d57c1ec1f diff --git a/smojol-core/src/main/java/org/smojol/common/navigation/CobolEntityNavigator.java b/smojol-core/src/main/java/org/smojol/common/navigation/CobolEntityNavigator.java index 49b7cb22..d7d80074 100644 --- a/smojol-core/src/main/java/org/smojol/common/navigation/CobolEntityNavigator.java +++ b/smojol-core/src/main/java/org/smojol/common/navigation/CobolEntityNavigator.java @@ -12,9 +12,11 @@ import java.util.Map; import java.util.function.BiFunction; import java.util.function.Function; +import java.util.logging.Logger; import java.util.regex.Pattern; public class CobolEntityNavigator { + private static final java.util.logging.Logger LOGGER = Logger.getLogger(CobolEntityNavigator.class.getName()); @Getter private final ParseTree root; private List dialectNodes; private Map symbolText; @@ -73,6 +75,10 @@ public void buildDialectNodeRepository() { symbolText = new HashMap<>(); dialectNodes.forEach(n -> { + LOGGER.info("Adding to repository dialect node " + n.getText()); + if (n.getChildCount() == 0) { + LOGGER.info("WARNING: The following dialect node has no children: " + n.getText()); + } String markerID = "_DIALECT_ " + n.getChild(1).getText(); ParseTree idmsContainer = findByCondition(n, c -> c.getClass() == IdmsContainerNode.class, 1); String text = NodeText.originalText(idmsContainer.getChild(0), NodeText::PASSTHROUGH); diff --git a/smojol-test-code/cics.cbl b/smojol-test-code/cics.cbl new file mode 100644 index 00000000..a03890f9 --- /dev/null +++ b/smojol-test-code/cics.cbl @@ -0,0 +1,50 @@ + IDENTIFICATION DIVISION. + PROGRAM-ID. IRREDUCIBLE-TEST. + AUTHOR. MOJO. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TESTING PIC 9(8) VALUE 100. + PROCEDURE DIVISION. + INITSTART. + ***************************************************************** + ***************************************************************** + WRITEQTDQ. + ***************************************************************** + + EXEC CICS + WRITEQ TD + QUEUE ('TERR') + FROM (MSGE-RCRD) + LENGTH (LENGTH OF MSGE-RCRD) + NOHANDLE + END-EXEC. + + IF EIBRESP > 0 + PERFORM WRITECONSOLE THRU WC-EXIT + END-IF. + + TDQ-EXIT. EXIT. + ***************************************************************** + WRITECONSOLE. + ***************************************************************** + + MOVE EIBRESP TO WSC-EIBRESP. + MOVE MSGNO TO WSC-MSGNO. + + EXEC CICS + WRITE OPERATOR + TEXT (WSC-MSG) + TEXTLENGTH (62) + EVENTUAL + END-EXEC. + + WC-EXIT. EXIT. + + ***************************************************************** + TERMIN. + ***************************************************************** + + EXEC CICS RETURN END-EXEC. + + TERMIN-EXIT. EXIT. diff --git a/smojol-toolkit/src/main/java/org/smojol/toolkit/examples/BaseModelMain_Issue69.java b/smojol-toolkit/src/main/java/org/smojol/toolkit/examples/BaseModelMain_Issue69.java new file mode 100644 index 00000000..972b33b5 --- /dev/null +++ b/smojol-toolkit/src/main/java/org/smojol/toolkit/examples/BaseModelMain_Issue69.java @@ -0,0 +1,39 @@ +package org.smojol.toolkit.examples; + +import com.google.common.collect.ImmutableList; +import org.smojol.common.dialect.LanguageDialect; +import org.smojol.common.flowchart.FlowchartOutputFormat; +import org.smojol.common.id.UUIDProvider; +import org.smojol.common.resource.LocalFilesystemOperations; +import org.smojol.toolkit.analysis.pipeline.ProgramSearch; +import org.smojol.toolkit.analysis.task.analysis.CodeTaskRunner; +import org.smojol.toolkit.interpreter.FullProgram; +import org.smojol.toolkit.interpreter.structure.OccursIgnoringFormat1DataStructureBuilder; +import org.smojol.toolkit.task.AnalysisTaskResult; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static org.smojol.toolkit.task.CommandLineAnalysisTask.*; + +public class BaseModelMain_Issue69 { + public static void main(String[] args) throws IOException, InterruptedException { + Map> result = new CodeTaskRunner("/Users/asgupta/code/smojol/smojol-test-code", + "/Users/asgupta/code/smojol/out/report", + ImmutableList.of(new File("/Users/asgupta/code/smojol/smojol-test-code")), + "/Users/asgupta/code/smojol/che-che4z-lsp-for-cobol-integration/server/dialect-idms/target/dialect-idms.jar", + LanguageDialect.COBOL, new FullProgram(FlowchartOutputFormat.PNG, new UUIDProvider()), + new UUIDProvider(), + new OccursIgnoringFormat1DataStructureBuilder(), + new ProgramSearch(), + new LocalFilesystemOperations()) + .runForPrograms(ImmutableList.of(BUILD_BASE_ANALYSIS), ImmutableList.of("cics.cbl")); + result.forEach((key, results) -> { + System.out.println(key); + results.forEach(System.out::println); + }); + System.out.println("DONE"); + } +}