Algomorph / CodeGrader

A Chrome browser plugin for aiding the teaching assistants grade code style on student's homework project submissions at the CS department of University of Maryland, College Park.
Other
6 stars 4 forks source link

Parser Does Not Like Method Reference Separator (::) #175

Open msimmon6 opened 2 years ago

msimmon6 commented 2 years ago

Describe the bug

Parse error in a file, 99% sure it is due to the :: operator. The student, by all accounts, definitely did not know what they were doing. We should still probably handle it.

Where did the bug occur

Semester: Summer 2022 Instructor & Course: Pedram's CMSC132 Project name on Submit Server: Exam 2 Student directory id: thou1

Code segment (if known & relevant):

// Just a portion, only one line is important
Collections.sort(intcollect);
int[] arr = new int[intcollect.size()];
Arrays.setAll(arr, intcollect::get);
return arr;

Additional info

image

Looks like it was expecting an operator, but not this one. It's probably a simple fix of adding :: as a valid operator.

msimmon6 commented 2 years ago

Also occurs in student's P1

msimmon6 commented 2 years ago

Edit: It's considered a separator https://docs.oracle.com/javase/specs/jls/se15/html/jls-3.html#jls-3.11

msimmon6 commented 2 years ago

I think the answer is just including "::" in the list of separators at the bottom of your Java.1.15.pegjs file, but the actual parser file in this looks too intimidating to edit... I will leave it to you to fix.

Algomorph commented 2 years ago

No problem, thanks for reporting. I've been aware of this issue for over a year now, just these one-off occurrences tend to be super-rare in 131 and 132 student code. Thanks for creating the issue, maybe it will be useful in the future -- but we'll hold off on the fix for now.

msimmon6 commented 2 years ago

Yeah -- this person has done it twice now so I hope she does not continue :(