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

Make language identifiers private #763

Merged
merged 1 commit into from
Nov 7, 2022
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
4 changes: 2 additions & 2 deletions cli/src/main/java/de/jplag/cli/CommandLineArgument.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public enum CommandLineArgument {
NEW_DIRECTORY(new Builder("-new", String.class).nargs(NumberOfArgumentValues.ONE_OR_MORE_VALUES)),
OLD_DIRECTORY(new Builder("-old", String.class).nargs(NumberOfArgumentValues.ONE_OR_MORE_VALUES)),
LANGUAGE(
new Builder("-l", String.class).defaultsTo(de.jplag.java.Language.IDENTIFIER)
new Builder("-l", String.class).defaultsTo(new de.jplag.java.Language().getIdentifier())
.choices(LanguageLoader.getAllAvailableLanguageIdentifiers())),
BASE_CODE("-bc", String.class),

Expand Down Expand Up @@ -85,7 +85,7 @@ public enum CommandLineArgument {
* The identifier of the default {@link Language}.
* @see Language#getIdentifier()
*/
public static final String DEFAULT_LANGUAGE_IDENTIFIER = de.jplag.java.Language.IDENTIFIER;
public static final String DEFAULT_LANGUAGE_IDENTIFIER = new de.jplag.java.Language().getIdentifier();

private final String flag;
private final NumberOfArgumentValues numberOfValues;
Expand Down
2 changes: 1 addition & 1 deletion languages/cpp/src/main/java/de/jplag/cpp/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

private final Scanner scanner; // cpp code is scanned not parsed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@MetaInfServices(de.jplag.Language.class)
public class Language extends de.jplag.emf.Language {
private static final String NAME = "EMF metamodels (dynamically created token set)";
public static final String IDENTIFIER = "emf-dynamic";
private static final String IDENTIFIER = "emf-dynamic";

private static final int DEFAULT_MIN_TOKEN_MATCH = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Language implements de.jplag.Language {
public static final String FILE_ENDING = "." + EcorePackage.eNAME;

private static final String NAME = "EMF metamodel";
public static final String IDENTIFIER = "emf";
private static final String IDENTIFIER = "emf";
private static final int DEFAULT_MIN_TOKEN_MATCH = 6;

protected final EcoreParser parser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class Language implements de.jplag.Language {

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

private final Parser parser;

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

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

public static final String IDENTIFIER = "python3";
private static final String IDENTIFIER = "python3";

private final Parser parser;

Expand Down
2 changes: 1 addition & 1 deletion languages/rlang/src/main/java/de/jplag/rlang/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class Language implements de.jplag.Language {

private static final String NAME = "R Parser";
public static final String IDENTIFIER = "rlang";
private static final String IDENTIFIER = "rlang";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
private static final String[] FILE_EXTENSION = {".R", ".r"};
private final RParserAdapter parserAdapter;
Expand Down
6 changes: 3 additions & 3 deletions languages/rust/src/main/java/de/jplag/rust/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
public class Language implements de.jplag.Language {

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

private final RustParserAdapter parserAdapter;

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

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

public Language() {
Expand Down
2 changes: 1 addition & 1 deletion languages/swift/src/main/java/de/jplag/swift/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@MetaInfServices(de.jplag.Language.class)
public class Language implements de.jplag.Language {

public static final String IDENTIFIER = "swift";
private static final String IDENTIFIER = "swift";

private static final String NAME = "Swift Parser";
private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
Expand Down
2 changes: 1 addition & 1 deletion languages/text/src/main/java/de/jplag/text/Language.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@MetaInfServices(de.jplag.Language.class)
public class Language implements de.jplag.Language {

public static final String IDENTIFIER = "text";
private static final String IDENTIFIER = "text";
private final ParserAdapter parserAdapter;

public Language() {
Expand Down