Skip to content
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

feature: update dialect API to support Dialect based compiler directives #2211

Merged
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
2 changes: 1 addition & 1 deletion server/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>common</artifactId>
<groupId>org.eclipse.lsp.cobol</groupId>
<version>1.0.3</version>
<version>1.0.4</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.*;
import org.eclipse.lsp.cobol.common.AnalysisConfig;
import org.eclipse.lsp.cobol.common.ResultWithErrors;
import org.eclipse.lsp.cobol.common.action.CodeActionProvider;
import org.eclipse.lsp.cobol.common.copybook.CopybookModel;
import org.eclipse.lsp.cobol.common.error.SyntaxError;
import org.eclipse.lsp.cobol.common.model.tree.CompilerDirectiveNode;
import org.eclipse.lsp.cobol.common.processor.ProcessorDescription;

import java.util.*;

/** A COBOL dialect */
public interface CobolDialect {
String FILLER = "\u200B";
Expand Down Expand Up @@ -132,4 +132,13 @@ default List<CodeActionProvider> getDialectCodeActionProviders() {
default List<CopybookModel> getPredefinedCopybook(AnalysisConfig ctx) {
return ImmutableList.of();
}

/**
* Returns the list of {@link CompilerDirectiveNode} specific to the dialect
* @param context is a DialectProcessingContext class with all needed data for dialect processing
* @return a list of {@link CompilerDirectiveNode}
*/
default List<CompilerDirectiveNode> getCompilerDirectives(DialectProcessingContext context) {
return ImmutableList.of();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@
*/
package org.eclipse.lsp.cobol.common.model.tree;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.lsp.cobol.common.model.Locality;
import org.eclipse.lsp.cobol.common.model.NodeType;

/** Node describing compiler directive in a cobol document. */
@Slf4j
@Deprecated
@EqualsAndHashCode(callSuper = true)
@Getter
public class CompilerDirectiveNode extends Node {
@Getter private final String directiveText;
private final String directiveText;
private final String dialect;

public CompilerDirectiveNode(Locality location, String directiveText) {
this(location, directiveText, "COBOL");
}

public CompilerDirectiveNode(Locality location, String directiveText, String dialect) {
super(location, NodeType.COMPILER_DIRECTIVE);
this.directiveText = directiveText;
this.dialect = dialect;
}
}
Loading