From 243c0a337ae62543dd25e5fb9482c0c356eb842f Mon Sep 17 00:00:00 2001 From: Leonid Baranov Date: Thu, 29 Feb 2024 14:32:07 +0100 Subject: [PATCH] chore: Add two nodes for handling exceptions in COBOL statements --- .../lsp/cobol/common/model/NodeType.java | 2 ++ .../common/model/tree/OnExceptionNode.java | 32 +++++++++++++++++++ .../common/model/tree/OnNotExceptionNode.java | 32 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnExceptionNode.java create mode 100644 server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnNotExceptionNode.java diff --git a/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/NodeType.java b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/NodeType.java index a2b40c93a4..31582e231a 100644 --- a/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/NodeType.java +++ b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/NodeType.java @@ -42,6 +42,8 @@ public enum NodeType { LITERAL, MERGE, OBSOLETE, + ON_EXCEPTION, + ON_NOT_EXCEPTION, OPEN_STATEMENT, PARAGRAPH, PARAGRAPH_NAME_NODE, diff --git a/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnExceptionNode.java b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnExceptionNode.java new file mode 100644 index 0000000000..1a6569088a --- /dev/null +++ b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnExceptionNode.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Broadcom. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Broadcom, Inc. - initial API and implementation + * + */ +package org.eclipse.lsp.cobol.common.model.tree; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.ToString; +import org.eclipse.lsp.cobol.common.model.Locality; +import org.eclipse.lsp.cobol.common.model.NodeType; + +/** The class represents an ON EXCEPTION statement in Cobol */ +@ToString(callSuper = true) +@Getter +@EqualsAndHashCode(callSuper = true) +public class OnExceptionNode extends Node { + + public OnExceptionNode(Locality location) { + super(location, NodeType.ON_EXCEPTION); + } +} diff --git a/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnNotExceptionNode.java b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnNotExceptionNode.java new file mode 100644 index 0000000000..59fffe3b37 --- /dev/null +++ b/server/common/src/main/java/org/eclipse/lsp/cobol/common/model/tree/OnNotExceptionNode.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Broadcom. + * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Broadcom, Inc. - initial API and implementation + * + */ +package org.eclipse.lsp.cobol.common.model.tree; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.ToString; +import org.eclipse.lsp.cobol.common.model.Locality; +import org.eclipse.lsp.cobol.common.model.NodeType; + +/** The class represents an ON NOT EXCEPTION statement in Cobol */ +@ToString(callSuper = true) +@Getter +@EqualsAndHashCode(callSuper = true) +public class OnNotExceptionNode extends Node { + + public OnNotExceptionNode(Locality location) { + super(location, NodeType.ON_NOT_EXCEPTION); + } +}