Skip to content

Commit

Permalink
Refactored CSharpModule to new framework.
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoOfTwelve committed Oct 4, 2023
1 parent 79fef14 commit 4f12de7
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 603 deletions.
5 changes: 5 additions & 0 deletions languages/csharp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
<dependency>
<groupId>de.jplag</groupId>
<artifactId>language-antlr-utils</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>

<build>
Expand Down
18 changes: 3 additions & 15 deletions languages/csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
package de.jplag.csharp;

import java.io.File;
import java.util.List;
import java.util.Set;

import org.kohsuke.MetaInfServices;

import de.jplag.ParsingException;
import de.jplag.Token;
import de.jplag.antlr.AbstractAntlrLanguage;

/**
* C# language with full support of C# 6 features and below.
* @author Timur Saglam
*/
@MetaInfServices(de.jplag.Language.class)
public class CSharpLanguage implements de.jplag.Language {
public class CSharpLanguage extends AbstractAntlrLanguage {
private static final String NAME = "C# 6 Parser";
private static final String IDENTIFIER = "csharp";
private static final String[] FILE_ENDINGS = new String[] {".cs", ".CS"};
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;

private final CSharpParserAdapter parser;

public CSharpLanguage() {
parser = new CSharpParserAdapter();
super(new CSharpParserAdapter());
}

@Override
Expand All @@ -45,9 +38,4 @@ public String getIdentifier() {
public int minimumTokenMatch() {
return DEFAULT_MIN_TOKEN_MATCH;
}

@Override
public List<Token> parse(Set<File> files) throws ParsingException {
return parser.parse(files);
}
}
Loading

0 comments on commit 4f12de7

Please sign in to comment.