From: Stefan S. <se...@sy...> - 2004-09-03 02:58:49
|
jal...@st... wrote: > Hello Everyone again, > > I have fixed the throw clause problem that was in my previous email by > changing the body of the method bool Parser::optThrowDecl(Ptree*& throw_decl) > in the parser.cc file (for OpenC++ 2.5.12 but each version of OpenC++ has the > same implementation for this method). Here is what I changed this method to: [...] Thanks for the bug report, and thanks for trying to fix it ! I don't think your code really solves the problem, though. Here is my understanding of the problem: First note that the ptree fragment that results from parsing the declaration is never used as of now. (Grzegorz: we should add new ptree nodes for this, shouldn't we ?) optThrowDecl uses 'rName' in a loop, i.e. it assumes the throw specifier contains a list of identifiers. That is probably so because in most cases what you throw is a class, and as non-builtin types are not looked up during this stage of the parsing, optThrowDecl simply has to look for identifiers. Now you put a builtin type there, which the lexer reports as a special token, which the parser doesn't expect (it expects identifiers !). Boom !! You have replaced the loop involving 'rName' with 'rTempArgList'. That's a method that parses template arguments, which is probably not what you thought what it does :-) Anyways I believe as this wasn't really a problem until now we should just keep a record of this bug (a good case for a unit test to remind us until we fix it !) and fix it when we can. That is, I believe, as soon as we have a symbol lookup mechanism integrated into the parser, and thus we can look for a 'list of types'. Makes sense ? Thanks for your your help ! Stefan |