[antlr-interest] IToken's getColumn() question, one TAB equals 9 spaces, 2 TABs equals 17?

Alexey Demakov demakov at ispras.ru
Tue Mar 7 04:38:53 PST 2006


Default tab size is 8. Call CharScanner's method
setTabSize(int size) to override default setting.

Regards,
Alexey

-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com


----- Original Message ----- 
From: "Ëï¼Í¸Õ Jigang (Robert) Sun" <sunjigang1965 at yahoo.com.cn>
To: <antlr-interest at antlr.org>
Sent: Tuesday, March 07, 2006 3:01 PM
Subject: [?? Probable Spam] [antlr-interest] IToken's getColumn() question,one TAB equals 9 spaces, 2 TABs equals 17?


>I am using IToken's getColumn() method to get token postion. The getLine() works fine, and
> getColumn() works fine on spaces entered by pressing spacebar of keyboard. But getColumn() could
> not calculate length of '\t' correctly: when only one TAB character place before my token, it
> returns 9(should be 5), twos TABs count as 17(should be 9).
>
> Should any action be added to '\t' alternative of the following lexer grammar?
>
> WS:
> ( "//" ('\t'| ' '..'~')* ('\r''\n' )
>
> | ' '
> | '\t'
> | '\n'
> | '\r' '\n'{newline();}
>
> ) {$setType(Token.SKIP);} ;
>
> Cheers.
>
> Jigang 




More information about the antlr-interest mailing list