From d150a6a8b11f6f3d48d2e16a82a12ea0176ecc2e Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Sat, 3 Aug 2024 14:29:35 +0200 Subject: [PATCH 1/4] refactor language names --- languages/c/src/main/java/de/jplag/c/CLanguage.java | 3 ++- languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java | 3 ++- .../csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java | 2 +- .../golang/src/main/java/de/jplag/golang/GoLanguage.java | 2 +- languages/java/src/main/java/de/jplag/java/JavaLanguage.java | 3 ++- .../kotlin/src/main/java/de/jplag/kotlin/KotlinLanguage.java | 2 +- .../llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java | 2 +- .../src/main/java/de/jplag/python3/PythonLanguage.java | 4 ++-- languages/rlang/src/main/java/de/jplag/rlang/RLanguage.java | 2 +- languages/rust/src/main/java/de/jplag/rust/RustLanguage.java | 2 +- .../scala/src/main/scala/de/jplag/scala/ScalaLanguage.scala | 2 +- .../scheme/src/main/java/de/jplag/scheme/SchemeLanguage.java | 3 ++- .../scxml/src/main/java/de/jplag/scxml/ScxmlLanguage.java | 2 +- .../swift/src/main/java/de/jplag/swift/SwiftLanguage.java | 2 +- .../text/src/main/java/de/jplag/text/NaturalLanguage.java | 3 ++- .../src/main/java/de/jplag/typescript/TypeScriptLanguage.java | 3 ++- 16 files changed, 23 insertions(+), 17 deletions(-) diff --git a/languages/c/src/main/java/de/jplag/c/CLanguage.java b/languages/c/src/main/java/de/jplag/c/CLanguage.java index ba99dbf498..c55dbf60b3 100644 --- a/languages/c/src/main/java/de/jplag/c/CLanguage.java +++ b/languages/c/src/main/java/de/jplag/c/CLanguage.java @@ -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 @@ -27,7 +28,7 @@ public String[] suffixes() { @Override public String getName() { - return "C Scanner"; + return NAME; } @Override diff --git a/languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java b/languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java index c08e53dce1..b76dfc823e 100644 --- a/languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java +++ b/languages/cpp/src/main/java/de/jplag/cpp/CPPLanguage.java @@ -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() { @@ -23,7 +24,7 @@ public String[] suffixes() { @Override public String getName() { - return "C++ Parser"; + return NAME; } @Override diff --git a/languages/csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java b/languages/csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java index aeeb53728f..67d24c60aa 100644 --- a/languages/csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java +++ b/languages/csharp/src/main/java/de/jplag/csharp/CSharpLanguage.java @@ -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; diff --git a/languages/golang/src/main/java/de/jplag/golang/GoLanguage.java b/languages/golang/src/main/java/de/jplag/golang/GoLanguage.java index e14926b43e..cb2d08eace 100644 --- a/languages/golang/src/main/java/de/jplag/golang/GoLanguage.java +++ b/languages/golang/src/main/java/de/jplag/golang/GoLanguage.java @@ -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"}; diff --git a/languages/java/src/main/java/de/jplag/java/JavaLanguage.java b/languages/java/src/main/java/de/jplag/java/JavaLanguage.java index a941dda67f..79d32f502c 100644 --- a/languages/java/src/main/java/de/jplag/java/JavaLanguage.java +++ b/languages/java/src/main/java/de/jplag/java/JavaLanguage.java @@ -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; @@ -29,7 +30,7 @@ public String[] suffixes() { @Override public String getName() { - return "Javac based AST plugin"; + return NAME; } @Override diff --git a/languages/kotlin/src/main/java/de/jplag/kotlin/KotlinLanguage.java b/languages/kotlin/src/main/java/de/jplag/kotlin/KotlinLanguage.java index 487effaa24..9b7678681e 100644 --- a/languages/kotlin/src/main/java/de/jplag/kotlin/KotlinLanguage.java +++ b/languages/kotlin/src/main/java/de/jplag/kotlin/KotlinLanguage.java @@ -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"}; diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java index 846a047e68..3dc983529f 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java @@ -11,7 +11,7 @@ @MetaInfServices(Language.class) public class LLVMIRLanguage extends AbstractAntlrLanguage { - private static final String NAME = "LLVMIR Parser"; + private static final String NAME = "LLVMIR"; private static final String IDENTIFIER = "llvmir"; private static final int DEFAULT_MIN_TOKEN_MATCH = 70; private static final String[] FILE_EXTENSIONS = {".ll"}; diff --git a/languages/python-3/src/main/java/de/jplag/python3/PythonLanguage.java b/languages/python-3/src/main/java/de/jplag/python3/PythonLanguage.java index 3df6587284..2a70481276 100644 --- a/languages/python-3/src/main/java/de/jplag/python3/PythonLanguage.java +++ b/languages/python-3/src/main/java/de/jplag/python3/PythonLanguage.java @@ -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() { @@ -20,7 +20,7 @@ public String[] suffixes() { @Override public String getName() { - return "Python3 Parser"; + return NAME; } @Override diff --git a/languages/rlang/src/main/java/de/jplag/rlang/RLanguage.java b/languages/rlang/src/main/java/de/jplag/rlang/RLanguage.java index d09e23b722..98b0171bf9 100644 --- a/languages/rlang/src/main/java/de/jplag/rlang/RLanguage.java +++ b/languages/rlang/src/main/java/de/jplag/rlang/RLanguage.java @@ -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"}; diff --git a/languages/rust/src/main/java/de/jplag/rust/RustLanguage.java b/languages/rust/src/main/java/de/jplag/rust/RustLanguage.java index 50f0826e04..1a5cfa4f81 100644 --- a/languages/rust/src/main/java/de/jplag/rust/RustLanguage.java +++ b/languages/rust/src/main/java/de/jplag/rust/RustLanguage.java @@ -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; diff --git a/languages/scala/src/main/scala/de/jplag/scala/ScalaLanguage.scala b/languages/scala/src/main/scala/de/jplag/scala/ScalaLanguage.scala index 424b0f7334..bf226a5ced 100644 --- a/languages/scala/src/main/scala/de/jplag/scala/ScalaLanguage.scala +++ b/languages/scala/src/main/scala/de/jplag/scala/ScalaLanguage.scala @@ -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" diff --git a/languages/scheme/src/main/java/de/jplag/scheme/SchemeLanguage.java b/languages/scheme/src/main/java/de/jplag/scheme/SchemeLanguage.java index 0ebbf4ef97..13e0c89f72 100644 --- a/languages/scheme/src/main/java/de/jplag/scheme/SchemeLanguage.java +++ b/languages/scheme/src/main/java/de/jplag/scheme/SchemeLanguage.java @@ -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; @@ -26,7 +27,7 @@ public String[] suffixes() { @Override public String getName() { - return "SchemeR4RS Parser [basic markup]"; + return NAME; } @Override diff --git a/languages/scxml/src/main/java/de/jplag/scxml/ScxmlLanguage.java b/languages/scxml/src/main/java/de/jplag/scxml/ScxmlLanguage.java index ec6316f4dd..ba4af3e8eb 100644 --- a/languages/scxml/src/main/java/de/jplag/scxml/ScxmlLanguage.java +++ b/languages/scxml/src/main/java/de/jplag/scxml/ScxmlLanguage.java @@ -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; diff --git a/languages/swift/src/main/java/de/jplag/swift/SwiftLanguage.java b/languages/swift/src/main/java/de/jplag/swift/SwiftLanguage.java index 87e13269fa..82a56d11e4 100644 --- a/languages/swift/src/main/java/de/jplag/swift/SwiftLanguage.java +++ b/languages/swift/src/main/java/de/jplag/swift/SwiftLanguage.java @@ -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; diff --git a/languages/text/src/main/java/de/jplag/text/NaturalLanguage.java b/languages/text/src/main/java/de/jplag/text/NaturalLanguage.java index 5727130097..057c06e56e 100644 --- a/languages/text/src/main/java/de/jplag/text/NaturalLanguage.java +++ b/languages/text/src/main/java/de/jplag/text/NaturalLanguage.java @@ -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() { @@ -31,7 +32,7 @@ public String[] suffixes() { @Override public String getName() { - return "Text Parser (naive)"; + return NAME; } @Override diff --git a/languages/typescript/src/main/java/de/jplag/typescript/TypeScriptLanguage.java b/languages/typescript/src/main/java/de/jplag/typescript/TypeScriptLanguage.java index 9fa5ad514c..8dda2b3486 100644 --- a/languages/typescript/src/main/java/de/jplag/typescript/TypeScriptLanguage.java +++ b/languages/typescript/src/main/java/de/jplag/typescript/TypeScriptLanguage.java @@ -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 @@ -20,7 +21,7 @@ public String[] suffixes() { @Override public String getName() { - return "Typescript Parser"; + return NAME; } @Override From 08bf805a21766f6497a92d909233bb5a376adbcc Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Sat, 3 Aug 2024 14:30:05 +0200 Subject: [PATCH 2/4] update names in report viewer --- report-viewer/src/model/Language.ts | 36 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/report-viewer/src/model/Language.ts b/report-viewer/src/model/Language.ts index 198f28399d..7e3add87d7 100644 --- a/report-viewer/src/model/Language.ts +++ b/report-viewer/src/model/Language.ts @@ -2,28 +2,26 @@ * Enum for the language parsers JPlag supports */ enum ParserLanguage { - JAVA = 'Javac based AST plugin', - PYTHON = 'Python3 Parser', - C = 'C Scanner', - CPP_OLD = 'C/C++ Scanner [basic markup]', - CPP = 'C++ Parser', - CPP_2 = 'C/C++ Parser', - C_SHARP = 'C# 6 Parser', - EMF_METAMODEL_DYNAMIC = 'emf-dynamic', + JAVA = 'Java', + PYTHON = 'Python', + C = 'C', + CPP = 'C++', + C_SHARP = 'C#', + EMF_METAMODEL_DYNAMIC = 'EMF metamodels (dynamically created token set)', EMF_METAMODEL = 'EMF metamodel', EMF_MODEL = 'EMF models (dynamically created token set)', - GO = 'Go Parser', - KOTLIN = 'Kotlin Parser', - R_LANG = 'R Parser', - RUST = 'Rust Language Module', - SCALA = 'Scala parser', - SCHEME = 'SchemeR4RS Parser [basic markup]', - SWIFT = 'Swift Parser', - TEXT = 'Text Parser (naive)', - SCXML = 'SCXML (Statechart XML)', - LLVM = 'LLVMIR Parser', + GO = 'Go', + KOTLIN = 'Kotlin', + R_LANG = 'R', + RUST = 'Rust', + SCALA = 'Scala', + SCHEME = 'Scheme', + SWIFT = 'Swift', + TEXT = 'Text (naive)', + SCXML = 'SCXML', + LLVM = 'LLVMIR', JAVASCRIPT = 'JavaScript', - TYPESCRIPT = 'Typescript Parser' + TYPESCRIPT = 'TypeScript' } type Language = ParserLanguage | 'unknown language' From bcec0e28e25600938e2542341c6aab11a8394971 Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Sat, 3 Aug 2024 14:54:27 +0200 Subject: [PATCH 3/4] fix report viewer build --- report-viewer/src/utils/CodeHighlighter.ts | 2 -- .../tests/unit/model/factories/OverviewFactory.test.ts | 2 +- report-viewer/tests/unit/model/factories/ValidOptions.json | 2 +- report-viewer/tests/unit/model/factories/ValidOverview.json | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/report-viewer/src/utils/CodeHighlighter.ts b/report-viewer/src/utils/CodeHighlighter.ts index ae3e958cbc..3191840e03 100644 --- a/report-viewer/src/utils/CodeHighlighter.ts +++ b/report-viewer/src/utils/CodeHighlighter.ts @@ -40,8 +40,6 @@ function getHighlightLanguage(lang: Language) { case ParserLanguage.C: return 'c' case ParserLanguage.CPP: - case ParserLanguage.CPP_OLD: - case ParserLanguage.CPP_2: return 'cpp' case ParserLanguage.C_SHARP: return 'csharp' diff --git a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts index 6852f5fbfd..447b439498 100644 --- a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts @@ -41,7 +41,7 @@ describe('Test JSON to Overview', () => { expect(await OverviewFactory.getOverview()).toEqual({ _submissionFolderPath: ['files'], _baseCodeFolderPath: '', - _language: 'Javac based AST plugin', + _language: 'Java', _fileExtensions: ['.java', '.JAVA'], _matchSensitivity: 9, _dateOfExecution: '12/07/23', diff --git a/report-viewer/tests/unit/model/factories/ValidOptions.json b/report-viewer/tests/unit/model/factories/ValidOptions.json index 7081e8a80a..db59e0c12b 100644 --- a/report-viewer/tests/unit/model/factories/ValidOptions.json +++ b/report-viewer/tests/unit/model/factories/ValidOptions.json @@ -1,5 +1,5 @@ { - "language": "Javac based AST plugin", + "language": "Java", "min_token_match": 9, "submission_directories": [ ".\\files" diff --git a/report-viewer/tests/unit/model/factories/ValidOverview.json b/report-viewer/tests/unit/model/factories/ValidOverview.json index 44787eea5e..35d133cd82 100644 --- a/report-viewer/tests/unit/model/factories/ValidOverview.json +++ b/report-viewer/tests/unit/model/factories/ValidOverview.json @@ -2,7 +2,7 @@ "jplag_version": { "major": 6, "minor": 0, "patch": 0 }, "submission_folder_path": ["files"], "base_code_folder_path": "", - "language": "Javac based AST plugin", + "language": "Java", "file_extensions": [".java", ".JAVA"], "submission_id_to_display_name": { "A": "A", "B": "B", "C": "C", "D": "D" }, "submission_ids_to_comparison_file_name": { From 630e27b1252e3f5b8b367ebafe43f030ae98a23e Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Thu, 15 Aug 2024 13:52:32 +0200 Subject: [PATCH 4/4] change LLVM IR name --- .../llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java index 3dc983529f..0d9ad7f150 100644 --- a/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java +++ b/languages/llvmir/src/main/java/de/jplag/llvmir/LLVMIRLanguage.java @@ -11,7 +11,7 @@ @MetaInfServices(Language.class) public class LLVMIRLanguage extends AbstractAntlrLanguage { - private static final String NAME = "LLVMIR"; + 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"};