[antlr-interest] ANTLR 3.0.1: invalid character column in a mismatch character error message.

Gavin Lambert antlr at mirality.co.nz
Wed Aug 13 14:21:41 PDT 2008


At 08:59 14/08/2008, Kay Röpke wrote:
 >I already see the next guy writing a syntax highlighter coming
 >along and complain about ANTLR expanding tabs to spaces so that
 >for input like "\tID" we report the start index of token ID as
 >being 8 (or 9 if someone insists on 
charPosInLine to be 1-based),
 >assuming that "standard tab width" is 8. If written in sloppy C
 >that could easily crash his application, and in any other
 >language it would at least cause an exception of some sort.
 >That's the fundamental reason I'm so strongly against handling
 >tabs in any special way.

Only if you *replace* the current position 
information, which I never advocated.  I think 
ANTLR should track *both*.  It's not as hard as 
you seem to be making out.  (At least not as far as I can see.)

(Well, ok, I *did* advocate replacing the char 
position shown in the error message dumped to the 
console with the column number.  But that just 
makes sense to me, and won't affect the 
syntax-highlighters or others who are using the 
object model directly anyway.)



More information about the antlr-interest mailing list