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

Wigg, J D wiggjd at lsbu.ac.uk
Wed Nov 28 05:42:59 PST 2007


Thanks Richard, I'll leave it as I've got it then.
 
Strange, I suppose nobody cares about the column number! Well they
can't can they. It doesn't work with any tabs as it stands. Perhaps
nobody uses tabs.
 
I wonder what the position is in ANTLR 3.0?
 
Anyway, thanks for taking the trouble to write,
 
David Wigg

________________________________

From: Richard Clark [mailto:rdclark at gmail.com]
Sent: Wed 28/11/2007 08:23
To: Wigg, J D
Subject: Re: [antlr-interest] Control of tab settings in ANTLR 2.7


Hello David, 

I suspect the lack of response is because most people are actively
using ANTLR 3 now. 

The short answer to Question 1 is: you have to alter the library
directly or create your own equivalent (possibly by subclassing the
library.) ANTLR 2's input mechanisms were black boxes for the most
part and not especially extensible. I had to write a couple of custom
variations for different projects. 

Re: question 2, if I recall correctly, the lexer used a "look ahead"
strategy which is probably why the lexer is evaluating the tab twice
-- once as a look-ahead, and then again in actually processing it. 

Off the top of my head, I'd consider a couple of options:
- Write my own input stream that expands the tabs into spaces, or
- Write an input stream that buffers each line, and if there's an
error have the error reporting scan the current line and update the
reported character offset based on how many tabs are to the left of
the error. 

I'm sorry I can't give you a more detailed or specific answer. Your
questions go into esoteric and undocumented parts of the system.

Regards,

...Richard
 



--
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/7db74466/attachment.html 


More information about the antlr-interest mailing list