Skip to content

feat: Add CCF support for CICS RETURN statement #2229

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

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.lsp.cobol.common.model.tree.statements.StatementNode;
import org.eclipse.lsp.cobol.common.model.variables.DivisionType;
import org.eclipse.lsp.cobol.core.model.extendedapi.*;
import org.eclipse.lsp.cobol.implicitDialects.cics.nodes.ExecCicsNode;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;

Expand Down Expand Up @@ -107,6 +108,11 @@ private void traverse(CFASTNode parent, Node node) {
addChild(parent, new CFASTNode(CFASTNodeType.EXIT.getValue(), convertLocation(node)));
} else if (node instanceof GoBackNode) {
addChild(parent, new CFASTNode(CFASTNodeType.GOBACK.getValue(), convertLocation(node)));
} else if (node instanceof ExecCicsNode) {
ExecCicsNode execCicsNode = (ExecCicsNode) node;
if (execCicsNode.isStopRun()) {
addChild(parent, new CFASTNode(CFASTNodeType.STOP.getValue(), convertLocation(node)));
}
} else if (node instanceof StopNode) {
addChild(parent, new CFASTNode(CFASTNodeType.STOP.getValue(), convertLocation(node)));
} else if (node instanceof ParagraphsNode || node instanceof ProcedureDivisionBodyNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public List<Node> visitQualifiedDataName(CICSParser.QualifiedDataNameContext ctx
public List<Node> visitCicsExecBlock(CICSParser.CicsExecBlockContext ctx) {
areaBWarning(ctx);
addReplacementContext(ctx);
return addTreeNode(ctx, locality -> new ExecCicsNode(locality, STATEMENT, CICSDialect.DIALECT_NAME));

boolean stopRun = (ctx.allCicsRule() != null && ctx.allCicsRule().size() > 0 && ctx.allCicsRule().get(0).cics_return() != null);
return addTreeNode(ctx, locality -> new ExecCicsNode(locality, STATEMENT, CICSDialect.DIALECT_NAME, stopRun));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@

package org.eclipse.lsp.cobol.implicitDialects.cics.nodes;

import lombok.Getter;
import org.eclipse.lsp.cobol.common.model.Locality;
import org.eclipse.lsp.cobol.common.model.NodeType;
import org.eclipse.lsp.cobol.common.model.tree.Node;

/** EXEC CICS block node */
public class ExecCicsNode extends Node {
public ExecCicsNode(Locality location, NodeType nodeType, String dialect) {

@Getter
private final boolean stopRun;

public ExecCicsNode(Locality location, NodeType nodeType, String dialect, boolean stopRun) {
super(location, nodeType, dialect);
this.stopRun = stopRun;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. CBACT01C.
PROCEDURE DIVISION.
EXEC CICS HANDLE ABEND
END-EXEC.
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"name": "CBACT01C",
"type": "program",
"location": {
"uri": "fake/path",
"start": {
"line": 3,
"character": 9
},
"end": {
"line": 5,
"character": 21
}
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
"line": 4,
"character": 30
}
}
},
"children": [
{
"type": "stop",
"location": {
"uri": "fake/path",
"start": {
"line": 4,
"character": 13
},
"end": {
"line": 4,
"character": 29
}
}
}
]
}
]