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

=?gb2312?q?=CB=EF=BC=CD=B8=D5=20Jigang=20(Robert)=20Sun?= sunjigang1965 at yahoo.com.cn
Tue Mar 7 04:01:25 PST 2006

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? 

(	"//" ('\t'| ' '..'~')* ('\r''\n' )

	| ' '
	| '\t'
	| '\n'
	| '\r' '\n'{newline();}

) {$setType(Token.SKIP);} ;





More information about the antlr-interest mailing list