JAVACC: Adjstments to column number for tab (\t) chars

sandip.chitale@brokat.com
3 May 2001 13:41:11 -0400

          From comp.compilers

Related articles
JAVACC: Adjstments to column number for tab (\t) chars sandip.chitale@brokat.com (2001-05-03)
Re: JAVACC: Adjstments to column number for tab (\t) chars rkrayhawk@aol.com (2001-05-18)
Re: JAVACC: Adjstments to column number for tab (\t) chars barry_j_kelly@hotmial.com (Barry Kelly) (2001-05-29)
| List of all articles for this month |

From: sandip.chitale@brokat.com
Newsgroups: comp.compilers
Date: 3 May 2001 13:41:11 -0400
Organization: http://www.newsranger.com
Keywords: Java, question
Posted-Date: 03 May 2001 13:41:11 EDT

I noticed that the generated JavaCC generated
ASCII_UCodeESC_CharStream.java adjusts the column numbers
when dealing with tabs (\t). Here is the snippet of the code -
private final void UpdateLineColumn(char c)
{
:
:
switch (c)
{
case '\r' :
prevCharIsCR = true;
break;
case '\n' :
prevCharIsLF = true;
break;
case '\t' :
column--;
column += (8 - (column & 07));
break;
default :
break;
}
:
:
}


This seems to assume a tab width of 8. Is this documented anywhere ?
Is there a way to turn this off. This is throwing off my beginColumn and
endColumn fields of my Tokens which I am trying to use to show the
selection in a JTextArea.


Has anyone run into this before ?


-sandip


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.