[antlr-interest] Re: Token.getFilename and Token.setFilename are not virtual!

antlrlist antlrlist at yahoo.com
Sun Aug 3 17:09:16 PDT 2003


(answer below)

--- In antlr-interest at yahoogroups.com, "Rodrigo B. de Oliveira"
<rodrigobamboo at h...> wrote:
> In the C# library.
> 
> I need my tokens to remember the filename but I've just noticed that
Token.getFilename and Token.setFilename are not virtual. And even if
they were, Token.setFilename is never called
> by CharScanner.
> 
> Is it ok to implement these changes? Whom should I submit the
changes to? I'd rather not have my own private copy of the library...
> 
> Thanks again,
> Rodrigo

Hi!

I had a similar problem when developing my java project (with the
charScanner; all java methods are virtual). Token.setFilename is
neither called from the CharScanner on java mode. After asking in the
forums, the answer I got was that setFilename wasn't invoked "because
your tokens may not come from a file". The answer wasn't Terence's; it
was from an ANTLR user.

This answer did not satisfy me; when I was going to modify ANTLR's
sources, someone pointed that I could override CharScanner::makeToken
(supposing that the java and C# classes use the same method names) and
add the filename in my Lexer. I suppose you could do the same in C#.

Even if the possibility exists, I'd like to see the filename set in
makeToken.

Just my two cents...

Enrique


 

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




More information about the antlr-interest mailing list