diff --git a/server/engine/src/main/java/org/eclipse/lsp/cobol/implicitDialects/sql/Db2SqlVisitor.java b/server/engine/src/main/java/org/eclipse/lsp/cobol/implicitDialects/sql/Db2SqlVisitor.java index ea9e660646..33371e287b 100644 --- a/server/engine/src/main/java/org/eclipse/lsp/cobol/implicitDialects/sql/Db2SqlVisitor.java +++ b/server/engine/src/main/java/org/eclipse/lsp/cobol/implicitDialects/sql/Db2SqlVisitor.java @@ -457,7 +457,7 @@ private Pair getWheneverType(Db2SqlPar ParseTree pt1 = ruleContext.getChild(2); if (Objects.equals(pt1.getText(), "DO")) { result = Pair.of(ExecSqlWheneverNode.WheneverType.DO, ruleContext.getChild(3).getText()); - } else if (Objects.equals(pt1.getText(), "GO TO") || Objects.equals(pt1.getText(), "GOTO")) { + } else if (Objects.equals(pt1.getText(), "GO") || Objects.equals(pt1.getText(), "GOTO")) { result = Pair.of(ExecSqlWheneverNode.WheneverType.GOTO, ruleContext.getChild(3).getText()); } } diff --git a/server/engine/src/test/resources/cfast/case_execSqlWhenever.cbl b/server/engine/src/test/resources/cfast/case_execSqlWhenever.cbl index aa93346fb1..266213af61 100644 --- a/server/engine/src/test/resources/cfast/case_execSqlWhenever.cbl +++ b/server/engine/src/test/resources/cfast/case_execSqlWhenever.cbl @@ -14,6 +14,8 @@ PROGRAM-ID. CBACT01C. PROCEDURE DIVISION. EXEC SQL WHENEVER SQLERROR GOTO HANDLER END-EXEC. + EXEC SQL WHENEVER SQLERROR GO TO HANDLER END-EXEC. + EXEC SQL WHENEVER SQLERROR CONTINUE END-EXEC. HANDLER. DISPLAY "HANDLER". diff --git a/server/engine/src/test/resources/cfast/case_execSqlWhenever.result.json b/server/engine/src/test/resources/cfast/case_execSqlWhenever.result.json index 6c4cacc014..38e7a82892 100644 --- a/server/engine/src/test/resources/cfast/case_execSqlWhenever.result.json +++ b/server/engine/src/test/resources/cfast/case_execSqlWhenever.result.json @@ -9,7 +9,7 @@ "character": 9 }, "end": { - "line": 19, + "line": 21, "character": 31 } }, @@ -45,6 +45,67 @@ } } }, + { + "wheneverCondition": "SQLERROR", + "wheneverType": "GOTO", + "value": "TO", + "type": "execwhenever", + "location": { + "uri": "fake/path", + "start": { + "line": 17, + "character": 22 + }, + "end": { + "line": 17, + "character": 49 + } + } + }, + { + "type": "endexec", + "location": { + "uri": "fake/path", + "start": { + "line": 17, + "character": 22 + }, + "end": { + "line": 17, + "character": 49 + } + } + }, + { + "wheneverCondition": "SQLERROR", + "wheneverType": "CONTINUE", + "type": "execwhenever", + "location": { + "uri": "fake/path", + "start": { + "line": 18, + "character": 22 + }, + "end": { + "line": 18, + "character": 46 + } + } + }, + { + "type": "endexec", + "location": { + "uri": "fake/path", + "start": { + "line": 18, + "character": 22 + }, + "end": { + "line": 18, + "character": 46 + } + } + }, { "snippet": "HANDLER.\r\n DISPLAY \"HANDLER\".", "name": "HANDLER", @@ -52,11 +113,11 @@ "location": { "uri": "fake/path", "start": { - "line": 18, + "line": 20, "character": 9 }, "end": { - "line": 19, + "line": 21, "character": 31 } }