[antlr-interest] Request enhancement ANTLR

John Allen Green greenj at ix.netcom.com
Thu Jun 20 00:00:29 PDT 2002


Silvain,

I've had to implement the same thing by using custom tokens and custom AST.
So that we don't store strings in all the tokens and nodes, I keep an
integer index of filenames, and just store the integer index of that
filename in the tokens and in the AST.

Whether it's useful or not - certainly it would be useful, but I don't know
if that extra little bit of storage can be justified in the default token
class and the default AST class...?

John


--On 20/06/2002 12:35 AM +0200 Silvain Piree wrote:

> Hi,
> 
> this is a request for enhancement of ANTLR.
> 
> Problem:
> ANTLR does not register filename information with tokens;
> only line/column information. 
> 
> This becomes a problem when using include files in which
> case it is unknown which source file a token originates from.
> 
> Solution:
> Add setFilename/getFilename to Token class and change
> other classes (including code generators) to use this method.
> 
> The impacted classes are: Token, CommonToken,
> CharScanner, LexerSharedInputState, JavaCodeGenerator
> and CppCodeGenerator.
> 
> I'd be willing to implement these changes if we agree that this
> enhancement is usefull.
> 
> Kind greetings, Silvain Piree
> 
> 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
>  



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list