From: Stefan S. <se...@sy...> - 2004-07-18 14:36:43
|
Grzegorz Jakacki wrote: >> Ah, now I understand again ! So, the solution is to add a type dictionary >> ('Environment' ?) to the Parser and then let the 'isTypeSpecifier' use >> that >> instead of just detecting built-in types. Right ? > > > For many cases this should work. However in general it will not. understood. Putting a type dictionary right into the parser means that the type recovery can't be done in a second pass, but instead has to be done as soon as a new type declaration has been detected. The separation between parser and mop libraries doesn't make sense in that context any more... > The top-level environment is maintained by ClassWalker. Driver in the > main loop runs Parser::rProgram() and feeds the obtained AST into > ClassWalker. Parser::rProgram() returns AST representing one top-level > construct (definition or declaration), so one iteration analyzes one > top-level construct. Only when ClassWalker traverses the AST, the > information about types defined in it are stuffed into Environment. what does 'ClassWalker' do ? The name suggests it is only inspecting class definitions, but not you are suggesting it deals with arbitrary type recovery. > This is fair enough when there is no namespaces or nested templates. > However, if top-level construct is a namespace, then Environment does > not have a clue about anything defined in it until it is fully parsed. hmm, I don't understand the design of Environment et al. yet. Why doesn't it 'have a clue' until it is 'fully parsed' ? In the example namespace Foo { typedef int Int; typedef std::vecor<Int> IntVector; } Shouldn't it know 'Int' when it sees the typedef for IntVector ? > I don't think there is an easy and complete solution. I have one > solution in mind, but it is neither cheap, nor easy. Please document the current design and the solutions you envision. It will help a lot to work out the remaining issues to make opencxx a very powerful tool that supports all standard C++. More and more people use synopsis, and the bug reports about parse errors I get become more and more sophisticated, indicating that it becomes more and more important to make the parser work correct not only for the most used C++ features, but really covering the full standard. Regards, Stefan |