diff --git a/jplag/src/main/java/de/jplag/JPlag.java b/jplag/src/main/java/de/jplag/JPlag.java index 0d3fb6c84..ed3806ec9 100644 --- a/jplag/src/main/java/de/jplag/JPlag.java +++ b/jplag/src/main/java/de/jplag/JPlag.java @@ -302,7 +302,7 @@ private void parseBaseCodeSubmission(Submission subm) throws ExitException { long startTime = System.currentTimeMillis(); print("----- Parsing basecode submission: " + subm.getName() + "\n", null); - switch (subm.parse(options.getMinimumTokenMatch())) { + switch (subm.parse(options.isDebugParser(), options.getMinimumTokenMatch())) { case OK: break; @@ -353,7 +353,7 @@ private void parseSubmissions(List submissions) throws ExitException count++; // Parse the submission and process the results. - switch (subm.parse(options.getMinimumTokenMatch())) { + switch (subm.parse(options.isDebugParser(), options.getMinimumTokenMatch())) { case OK: break; diff --git a/jplag/src/main/java/de/jplag/Submission.java b/jplag/src/main/java/de/jplag/Submission.java index 7f4eea984..09ab41ba4 100644 --- a/jplag/src/main/java/de/jplag/Submission.java +++ b/jplag/src/main/java/de/jplag/Submission.java @@ -121,7 +121,7 @@ public void setState(SubmissionState newState) { * Parse the submission. * @return State of the submission after the parse. */ - public SubmissionState parse(int minimumTokenLength) { + public SubmissionState parse(boolean storeFilesWithParseErrors, int minimumTokenLength) { if (parseFiles(storeFilesWithParseErrors)) { if (tokenList == null || tokenList.size() < minimumTokenLength) { state = SubmissionState.TOO_SHORT; // parseFiles() didn't fail, so no parse errors found. @@ -133,10 +133,11 @@ public SubmissionState parse(int minimumTokenLength) { /** * Parse the files of the submission and update state. + * @param storeFilesWithParseErrors Whether files with parse errors should be stored. * @return Whether parse was successful. * @note Successful parse doesn't necessarily imply an {@link SubmissionState#OK OK} state. */ - private boolean parseFiles() { + private boolean parseFiles(boolean storeFilesWithParseErrors) { if (files == null || files.size() == 0) { program.print("ERROR: nothing to parse for submission \"" + name + "\"\n", null); return false; @@ -157,7 +158,7 @@ private boolean parseFiles() { tokenList = null; state = SubmissionState.PARSE_ERRORS; // invalidate submission - if (program.getOptions().isDebugParser()) { + if (storeFilesWithParseErrors) { copySubmission(); } return false;