From: Stefan S. <se...@sy...> - 2006-03-17 13:37:47
|
Scott D. Fleming wrote: > Hi Jason, > It looks like OpenC++ doesn't recognize the "explicit" keyword. In > parser/Lex.cc, there are lines like: > > Lex.cc:853: { "inline", token(INLINE) }, > Lex.cc:887: { "volatile", token(VOLATILE) }, > > But there is nothing equivalent for "explicit". > > I think I can suggest a quick/dirty fix. The "explicit" specifier is > only used with constructors to prevent implicit type conversions. I Correct. > may be wrong, but I would expect that the specifier could just be > ignored as long as the client programmer is careful not to use > implicit conversions. As far as OpenC++ is concerned it simply means that occ would accept some code that is not valid. But since OpenC++ doesn't do any of the related analysis anyways, this is fine. > I'm pretty sure this could be accomplished by > adding a line as follows to the table[] definition in parser/Lex.cc > (found around line 810). > > { "explicit", token(Ignore) }, Right. The slightly more involved fix would be to provide a new token, and then teach the parser how to deal with it. At first it could ignore it, but eventually it could integrate it into the generated parse tree. That's what I did in the synopsis parser (http://synopsis.fresco.org/), i.e. I expect it as a regular 'function-specifier', as mandated by the C++ specification (ISO 14882). Regards, Stefan |