[antlr-interest] Re: can't override nextToken in c# version

micheal_jor open.zone at virgin.net
Fri Oct 10 16:38:08 PDT 2003


--- In antlr-interest at yahoogroups.com, "netminka" <netminka at n...> wrote:
> thanks for the suggestion.
> I tried defining nextToken() as new in the derived class and it
> doesn't override the base class 'new' nextToken. I'll try adding
> virtual to the derived class nextToken, though I suspect that
> adding virtual to the derived doesn't change the dominance of the base
> class method.
> megan

Megan,

In my suggested solution, the nextToken() method in the subclass hides
the existing method, it can't override it. 

The explicit implementation of the method for the TokenStream
interface is important though. That is how the Parser regards the
Lexer - as a TokenStream.

Now I've thought about it, you might just be coming up against issues
that arise where nextToken() is invoked within the underlying Lexer
and CharScanner classes. Any such invocation would obviously used the
existing, unoverridable method.

Cheers,

Micheal

[reaches for his ANTLR bug swatter...]


 

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




More information about the antlr-interest mailing list