From: Andre B. <and...@gm...> - 2003-05-15 16:15:31
|
Baptiste Lepilleur wrote: >Welcome back Andre. I saw that you fixed a few parsing bugs. It's now up to >81% being parsed. The major remaining bug concerns parsing constructor >declaration inside class (see file bug/list.txt for details). > ok, I missed that point - i check these as soon as possible. >I've also experimented with implementing a mini-parser (see MiniParserTest). >It's work well, but I have not yet figured out a good way to collect matched >range. My idea is not to use those mini-parser for the full implementation, >but for small piece of the parser, such as > >'class' export-macro class-name ':' inheritance { > >Nearly everything to parse the above structure is optional and the code get >difficult to read. I believe such a thing would allow for serious code clean >up, if we found a good way to retrieve the matched range. > >One idea I had was something like that: > >CStringView classDecl, className; >// parser for: 'class' class-name : >const Xtl::MiniParser &parser2 = (Xtl::StringMiniParser( "class " ) > >> >Xtl::CppIdentifierMiniParser()[className] > >> Xtl::CharMiniParser( >':' ))[classDecl]; > >But this would not work when working with repetition parser (for example, to >matchthe repetition of ('::' id) ). Any ideas ? > Well - it should work if the repeatition parser does some look ahead and allows only "::" to be 'eaten' (than it will stop at a single colon). Apart from that: is it possible to declare a class like this class XXX::class_name : public C { }; The miniparser stuff sounds good - seems to go into the direction of the boost parser but a little bit more lightweight. I like this idea, since much code of the declaration parser is not very easy to understand and I do feel that this could make some things easier. During the last days I started to work a little bit on the IdentifierResolver for supporting Class/Namescopes. That will take a while -depending on the time I can spent for this project, I will see if bug fixing and code clean up will be done first / in parallel or what ever :-). I have finished a class "IdentifierScope" which can hold information on sub scopes, as well as parent and root scope. It is possible to register identifier with their ASTNodePtr. Some more tests need to be written. Next step will be the integration in "IdentifierScopeResolverContext". I plan to move some of the implementation into IdentifierScope. What do you think about this ? Next week I'm definitly away and I don't know yet how much time is taken by my job after this... until then, André |