[antlr-interest] Control of tab settings in ANTLR 2.7

Wigg, J D wiggjd at lsbu.ac.uk
Tue Nov 27 23:30:03 PST 2007


Hello,
 
I am disappointed in not receiving any response to my query (Vol.36,
Issue 41, No. 9) about the use and control of tab settings in ANTLR
(2.7) which I repeat below.
 
Is this because there is a perfectly good description somewhere? If
so, I have not been able to find it by searching the ANTLR2 website
and I would be grateful if someone could tell me where it is.
 
Thank you.
 
Question 1.

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
function?

Question 2.

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 (in my case).

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 in tab() 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 in my case) .

Is the function working correctly and, if so, what am I doing wrong?

Thanks,

David.





--
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...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071128/45b2632f/attachment-0001.html 


More information about the antlr-interest mailing list