Skip to content

Commit

Permalink
Adding debugging statement for issue 69 where dialect node does not h…
Browse files Browse the repository at this point in the history
…ave serial number
  • Loading branch information
avishek-sen-gupta committed Nov 27, 2024
1 parent 86b2237 commit 78b2779
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParseTree> dialectNodes;
private Map<String, String> symbolText;
Expand Down Expand Up @@ -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);
Expand Down
50 changes: 50 additions & 0 deletions smojol-test-code/cics.cbl
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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<String, List<AnalysisTaskResult>> 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");
}
}

0 comments on commit 78b2779

Please sign in to comment.