Open ShreyasKallingal opened 3 months ago
I've narrowed it down to large multi-line comments. Not quite sure if it's a JPlag bug or something upstream in JavaCC. I'll try to find a fix.
This does appear to be upstream in JavaCC. I replicated it by building JPlag from source and found that 2 files generated by JavaCC are the issue: AbstractCharStream
and JavaCharStream
. These are built from https://github.com/javacc/javacc/blob/master/src/main/resources/templates/JavaCharStream.template (I think). However, I have no idea how or why AbstractCharStream
is generated—where's the source for this?
The bug is related to using the maxNextCharInd
variable to keep track of 2 different buffers. Strangely, the expandBuff
method in AbstractCharStream
changes the value of maxNextCharInd
, which JavaCharStream
relies on to keep track of its fixed-size m_aNextCharBuf
. The hacky fix is to define a new variable in JavaCharStream
to use separately and define the class in the normal sources to override generation (https://www.mojohaus.org/javacc-maven-plugin/faq.html#custom-sources). But not sure where to fix this in JavaCC itself—maybe I'll file an issue with them.
As a workaround you can try parsing the files with the cpp language module. Most c code actually works with that.
Hi, I'm trying to run JPlag 5.0.0 on a set of C file submissions. Parsing proceeds until around half way, at which point I encounter a classic array out of bounds exception in the underlying JavaCC parser. I wanted to debug further and isolate the submission causing the issue (the progress bar is delayed). But I could not figure out how to view trace-level logs in the terminal—any pointers? Thanks for the help!
Command:
java -jar lib/jplag-5.0.0-jar-with-dependencies.jar -l c -r results -bc skeleton -d submissions
Output: