Changing maxNextCharIndex = DEFAULT_BUFF_SIZE (currently it is 4096 ) has made it work .
The change is made in expandBuff() of AbstractCharStream class
I am using the following dependency
`.<groupId>com.helger.maven</groupId>
<artifactId>ph-javacc-maven-plugin</artifactId>
<version>4.1.4</version>`