Using JavaCC 6.0_1, with JDK_VERSION set to (the default of) 1.5, I'm unable to use the getErrorOffset method of ParseException - despite the Java docs stating that it exists.
Is there something I've missed?
Minimum example:
PARSER_BEGIN(B)
class B {
public static void main(String[] args) {
ParseException p = new ParseException("Test", 2);
System.out.println(p.getErrorOffset());
}
}
PARSER_END(B)
TOKEN: {<TRIVIAL: "foo">}
Results:
$ javacc B.jj
[...]
Parser generated successfully.
$ javac ./*.java
./B.java:5: error: no suitable constructor found for ParseException(String,int)
ParseException p = new ParseException("Test", 2);
^
constructor ParseException.ParseException(Token,int[][],String[]) is not applicable
(actual and formal argument lists differ in length)
constructor ParseException.ParseException() is not applicable
(actual and formal argument lists differ in length)
constructor ParseException.ParseException(String) is not applicable
(actual and formal argument lists differ in length)
./B.java:6: error: cannot find symbol
System.out.println(p.getErrorOffset());
^
symbol: method getErrorOffset()
location: variable p of type ParseException
2 errors
(The second error similarly shows that the "error offset" part of ParseException is mysteriously absent...)