From: Stefan S. <se...@sy...> - 2004-04-06 05:28:48
|
Grzegorz Jakacki wrote: > Hi Stefan, > > On Sun, 4 Apr 2004, Stefan Seefeld wrote: > > >>there are some valid C++ expressions openC++ doesn't >>yet understand. >> >>I'v just run into a fairly simple one: >> >>namespace Foo = Bar; >> >>that creates a namespace alias. Is there any chance >>that the parser gets fixed to recognize this ? > > > Yes, however parser is not self-healing system. AFAIK I am the only person heh :-) > doing anything to the code at the moment. I don't have resources to fix it > now. > > You hacked OpenC++ already, perhaps you could invest some time in this > fix. Please contact me for arrangements if you decide to do so. Fair enough. Attached is a patch that: * adds a new token ('ntNamespaceAlias'...luckily there are still some slots available ;-) * adds a new Ptree subclass 'PtreeNamespaceAlias' * adds a 'rNamespaceAlias' method to the parser that generates such a ptree * adds a dummy 'TranslateNamespaceAlias' to the Walker base class What should the parse tree for this declaration look like ? As I don't know any better, I just generate a simple list [ 'namespace' <alias> '=' <scoped.name> ';' ] (where scoped.name can be a list if it's not a simple identifier) The Walker::TranslateNamespaceAlias() method does nothing (yet), but should probably register the new alias to the environment. I'll let others fill that out :-) Regards, Stefan |