Permalink
Browse files

Parse C++11 classed enums

Part of #3578557.
  • Loading branch information...
1 parent f2f22d3 commit 6c7f69578d8e142f5994cc9cf0e0abc83a606a1b @b4n b4n committed Oct 22, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 tagmanager/ctags/c.c
View
@@ -1968,6 +1968,12 @@ static void readParents (statementInfo *const st, const int qualifier)
deleteToken (token);
}
+static void checkIsClassEnum (statementInfo *const st, const declType decl)
+{
+ if (! isLanguage (Lang_cpp) || st->declaration != DECL_ENUM)
+ st->declaration = decl;
+}
+
static void processToken (tokenInfo *const token, statementInfo *const st)
{
switch (token->keyword) /* is it a reserved word? */
@@ -1979,7 +1985,7 @@ static void processToken (tokenInfo *const token, statementInfo *const st)
case KEYWORD_ATTRIBUTE: skipParens (); initToken (token); break;
case KEYWORD_CATCH: skipParens (); skipBraces (); break;
case KEYWORD_CHAR: st->declaration = DECL_BASE; break;
- case KEYWORD_CLASS: st->declaration = DECL_CLASS; break;
+ case KEYWORD_CLASS: checkIsClassEnum (st, DECL_CLASS); break;
case KEYWORD_CONST: st->declaration = DECL_BASE; break;
case KEYWORD_DOUBLE: st->declaration = DECL_BASE; break;
case KEYWORD_ENUM: st->declaration = DECL_ENUM; break;
@@ -2003,7 +2009,7 @@ static void processToken (tokenInfo *const token, statementInfo *const st)
case KEYWORD_PUBLIC: setAccess (st, ACCESS_PUBLIC); break;
case KEYWORD_SHORT: st->declaration = DECL_BASE; break;
case KEYWORD_SIGNED: st->declaration = DECL_BASE; break;
- case KEYWORD_STRUCT: st->declaration = DECL_STRUCT; break;
+ case KEYWORD_STRUCT: checkIsClassEnum (st, DECL_STRUCT); break;
case KEYWORD_THROWS: discardTypeList (token); break;
case KEYWORD_TYPEDEF: st->scope = SCOPE_TYPEDEF; break;
case KEYWORD_UNION: st->declaration = DECL_UNION; break;

0 comments on commit 6c7f695

Please sign in to comment.