Skip to content

Commit

Permalink
Pass isDebugParser option down to submission parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberth289346 committed Nov 21, 2021
1 parent b67d8d4 commit 4e1f36f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jplag/src/main/java/de/jplag/JPlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -353,7 +353,7 @@ private void parseSubmissions(List<Submission> 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;

Expand Down
7 changes: 4 additions & 3 deletions jplag/src/main/java/de/jplag/Submission.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -157,7 +158,7 @@ private boolean parseFiles() {

tokenList = null;
state = SubmissionState.PARSE_ERRORS; // invalidate submission
if (program.getOptions().isDebugParser()) {
if (storeFilesWithParseErrors) {
copySubmission();
}
return false;
Expand Down

0 comments on commit 4e1f36f

Please sign in to comment.