[antlr-interest] Control of tab settings in ANTLR 2.7
Wigg, J D
wiggjd at lsbu.ac.uk
Tue Nov 20 08:32:00 PST 2007
I have been unable to find anything about the control and use of tab
characters in updating column numbers in the ANTLR2 documentation for
I want to use a tabsize of 4 characters instead of 8 as assumed in the
constructors in CharScanner.cpp which I have changed to 4. Is there
any other way of altering this value without altering a library
In order to adjust column numbers correctly I have inserted an action
after detecting a tab character in the lexer of "tab()" as required
which should adjust the column number appropriately.
When there is a tab at the beginning of a line, but not elsewhere, the
column number is incorrect (too many by the tabsize) and the reason
seems to be that when the tab is at the beginning of a line the tab
function is entered twice so that the column number is advanced to 9
instead of only 5.
I cannot see any reason for this (there appears to be only one tab at
the beginning of the line) but I can cure the problem by first
checking if the column number is 1 then setting the new column to 2 so
that on the second entry of tab() the column number is only advanced
by tabsize once (to 5).
Is the function working correctly and, if so, what am I doing wrong?
Copyright in this email and in any attachments belongs to London South Bank University. This email, and its attachments if any, may be confidential or legally privileged and is intended to be seen only by the person to whom it is addressed. If you are not the intended recipient, please note the following: (1) You should take immediate action to notify the sender and delete the original email and all copies from your computer systems; (2) You should not read copy or use the contents of the email nor disclose it or its existence to anyone else.
The views expressed herein are those of the author(s) and should not be taken as those of London South Bank University, unless this is specifically stated.
London South Bank University is a company limited by guarantee registered in England and Wales. The following details apply to London South Bank University: Company number - 00986761; Registered office and trading address - 103 Borough Road London SE1 0AA; VAT number - 778 1116 17; Email address - lsbuinfo at lsbu.ac.uk
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest