On parse of a text in which an expected terminating token is missing, my ANTLRErrorListener is notified of a syntax error via the syntaxError() method with message "no viable alternative at input '<EOF>'". So far so good. The possible issue I noticed is that the Token.getStart() of the received Token points just past the last character of my input, while the Token.getEnd() is at the end of my input. Having start > end seems rather confusing, and is not hinted at by the Javadocs.
Thoughts?
Mark A. Fitzgerald
ThoughtWire Corporation
Thanks for confirming this. (Sorry for the late reply.) Chances are it is documented in either the book or one of the documentation pages I've not yet read. :)
I mostly work from the Javadocs; the Javadoc for Token#getStopIndex() does not indicate whether the end index is inclusive or exclusive: http://www.antlr.org/api/Java/org/antlr/v4/runtime/Token.html#getStopIndex(). Perhaps that could be clarified in the Javadoc?
Have a good morning,
Mark
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.