[antlr-interest] ANTLR 3.0.1: invalid character column in a mismatch character error message.
Gavin Lambert
antlr at mirality.co.nz
Tue Aug 12 14:37:54 PDT 2008
At 09:31 12/08/2008, Terence Parr wrote:
>oh, right. Well, yeah, people expect column...problem is what
to
>do with tabs etc...can override message handler though
True, tabs could get tricky.
Still, couldn't the lexer have a setTabSize() method or
something? Default it to 8, since that's the official standard
tab size (even though most people usually reduce it), and let the
driver code (or ANTLRworks) modify as needed. Then ANTLR can
generate errors using the "true" column number instead of the char
position, which is fairly meaningless to an end user.
And yes, the handler can be overridden. But if it behaves as
people expect out of the box then it'll lead to less confusion,
especially for ANTLR newbies. And I think there's already enough
things to confuse newbies as it is ;)
I guess this means that the token would have to track both column
number and char position, though, since one cannot be simply
derived from the other. (Actually, on that note: does it also
track the absolute position in the char stream, instead of that
relative to the start of line? That could also be useful, if not.)
More information about the antlr-interest
mailing list