Skip to content

Commit

Permalink
Merge pull request #1902 from jplag/feature/better-language-names
Browse files Browse the repository at this point in the history
Fix inconsistent names of languages
  • Loading branch information
tsaglam authored Aug 29, 2024
2 parents 9b3094d + 7eeee1f commit 92837df
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion languages/c/src/main/java/de/jplag/c/CLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

@MetaInfServices(de.jplag.Language.class)
public class CLanguage implements Language {
private static final String NAME = "C";
private static final String IDENTIFIER = "c";

private final Scanner scanner; // c code is scanned not parsed
Expand All @@ -27,7 +28,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "C Scanner";
return NAME;
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
@MetaInfServices(Language.class)
public class CPPLanguage extends AbstractAntlrLanguage {
private static final String NAME = "C++";
private static final String IDENTIFIER = "cpp";

public CPPLanguage() {
Expand All @@ -23,7 +24,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "C++ Parser";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
@MetaInfServices(de.jplag.Language.class)
public class CSharpLanguage extends AbstractAntlrLanguage {
private static final String NAME = "C# 6 Parser";
private static final String NAME = "C#";
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@MetaInfServices(de.jplag.Language.class)
public class GoLanguage extends AbstractAntlrLanguage {
private static final String NAME = "Go Parser";
private static final String NAME = "Go";
private static final String IDENTIFIER = "go";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
private static final String[] FILE_EXTENSIONS = {".go"};
Expand Down
3 changes: 2 additions & 1 deletion languages/java/src/main/java/de/jplag/java/JavaLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
@MetaInfServices(de.jplag.Language.class)
public class JavaLanguage implements de.jplag.Language {
private static final String NAME = "Java";
private static final String IDENTIFIER = "java";

private final Parser parser;
Expand All @@ -29,7 +30,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "Javac based AST plugin";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@MetaInfServices(de.jplag.Language.class)
public class KotlinLanguage extends AbstractAntlrLanguage {

private static final String NAME = "Kotlin Parser";
private static final String NAME = "Kotlin";
private static final String IDENTIFIER = "kotlin";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
private static final String[] FILE_EXTENSIONS = {".kt"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@MetaInfServices(Language.class)
public class LLVMIRLanguage extends AbstractAntlrLanguage {

private static final String NAME = "LLVMIR Parser";
private static final String NAME = "LLVM IR";
private static final String IDENTIFIER = "llvmir";
private static final int DEFAULT_MIN_TOKEN_MATCH = 70;
private static final String[] FILE_EXTENSIONS = {".ll"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@MetaInfServices(de.jplag.Language.class)
public class PythonLanguage extends AbstractAntlrLanguage {

private static final String NAME = "Python";
private static final String IDENTIFIER = "python3";

public PythonLanguage() {
Expand All @@ -20,7 +20,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "Python3 Parser";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@MetaInfServices(de.jplag.Language.class)
public class RLanguage implements de.jplag.Language {

private static final String NAME = "R Parser";
private static final String NAME = "R";
private static final String IDENTIFIER = "rlang";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
private static final String[] FILE_EXTENSION = {".R", ".r"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class RustLanguage implements de.jplag.Language {

protected static final String[] FILE_EXTENSIONS = {".rs"};
private static final String NAME = "Rust Language Module";
private static final String NAME = "Rust";
private static final String IDENTIFIER = "rust";
private static final int MINIMUM_TOKEN_MATCH = 8;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ScalaLanguage extends de.jplag.Language {

override def suffixes: Array[String] = fileExtensions

override def getName = "Scala parser"
override def getName = "Scala"

override def getIdentifier = "scala"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@MetaInfServices(de.jplag.Language.class)
public class SchemeLanguage implements de.jplag.Language {

private static final String NAME = "Scheme";
private static final String IDENTIFIER = "scheme";
private final de.jplag.scheme.Parser parser;

Expand All @@ -26,7 +27,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "SchemeR4RS Parser [basic markup]";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ScxmlLanguage implements de.jplag.Language {
*/
public static final String VIEW_FILE_SUFFIX = ".scxmlview";

private static final String NAME = "SCXML (Statechart XML)";
private static final String NAME = "SCXML";
private static final String IDENTIFIER = "scxml";
private static final int DEFAULT_MIN_TOKEN_MATCH = 6;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SwiftLanguage implements de.jplag.Language {

private static final String IDENTIFIER = "swift";

private static final String NAME = "Swift Parser";
private static final String NAME = "Swift";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
private static final String[] FILE_EXTENSIONS = {".swift"};
private final SwiftParserAdapter parserAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
public class NaturalLanguage implements de.jplag.Language {

private static final String IDENTIFIER = "text";
private static final String NAME = "Text (naive)";
private final ParserAdapter parserAdapter;

public NaturalLanguage() {
Expand All @@ -31,7 +32,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "Text Parser (naive)";
return NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class TypeScriptLanguage extends AbstractAntlrLanguage {

private static final String IDENTIFIER = "typescript";
private static final String NAME = "TypeScript";
private final TypeScriptLanguageOptions options = new TypeScriptLanguageOptions();

@Override
Expand All @@ -20,7 +21,7 @@ public String[] suffixes() {

@Override
public String getName() {
return "Typescript Parser";
return NAME;
}

@Override
Expand Down

0 comments on commit 92837df

Please sign in to comment.