[antlr-interest] ANTLR 3.0.1: invalid character column in a mismatch character error message.
javafoust at gmail.com
Wed Aug 13 17:24:16 PDT 2008
Gavin Lambert wrote:
> At 09:05 14/08/2008, Foust wrote:
> >Is that true? The popular IDEs don't take line + character
> I've yet to see one that does. (Maybe they do internally, but
> internal calls are irrelevant to the point I'm trying to make,
> since you'll have access to the ANTLR-generated object model and
> can use whatever makes sense there.)
> Line numbers should start from 1 at the beginning of the file,
> and column numbers should start from 1 at the beginning of the line.
> (Both of these conventions are chosen for compatibility.)
> Calculate column numbers assuming that space and all ASCII printing
> characters have equal width, and assuming tab stops every 8 columns.
Note that the tab stops are fixed -- assumed at every 8 characters.
> >Do you think C++ compilers are really doing character ->
> >column# translations (with Tab translation) before
> >outputting syntax errors?
> Yes, I do.
Then that settles it, does it not?
It doesn't mean that Antlr can't have more expressive error messages (that
display the offending text as well), but for compatibility reasons, it does
seem to imply:
a) Column # 1 should be the first character (not 0)
b) A 0-based character offset field can also be supplied,
but the tab characters need to be taken into account
for error message output.
And it wouldn't be difficult to add to (b):
c) configurable tab width (instead of hard-coding a value of 8)
The additional storage requirements shouldn't be a major issue. But if the
processing turns out to slow the scanner down, then it can be architected so
that it can be turned off by the user who knows he doesn't need correct
More information about the antlr-interest