From 74f28ef1ca3be73dba4e8157729bab4cae40385d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 23 Apr 2015 12:29:09 +0200 Subject: [PATCH] qdoc: Now parses enum values containing commas qdoc can now parse enum values in the enum declaration where the enum value contains a comma. See, for example, thise values in QSysInfo::MacVersion: MV_IOS_4_3 = Q_MV_IOS(4, 3), MV_IOS_5_0 = Q_MV_IOS(5, 0), MV_IOS_5_1 = Q_MV_IOS(5, 1), MV_IOS_6_0 = Q_MV_IOS(6, 0), MV_IOS_6_1 = Q_MV_IOS(6, 1), MV_IOS_7_0 = Q_MV_IOS(7, 0), MV_IOS_7_1 = Q_MV_IOS(7, 1), MV_IOS_8_0 = Q_MV_IOS(8, 0) Change-Id: Idd7da89330efc0e9fa428a99b0090969ea1d97d9 Task-number: QTBUG-45758 Reviewed-by: Venugopal Shivashankar --- src/tools/qdoc/cppcodeparser.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index b088031d9d..552fb6a4ba 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -1781,10 +1781,18 @@ bool CppCodeParser::matchEnumItem(Aggregate *parent, EnumNode *enume) QString name = previousLexeme(); CodeChunk val; + int parenLevel = 0; if (match(Tok_Equal)) { - while (tok != Tok_Comma && tok != Tok_RightBrace && - tok != Tok_Eoi) { + while (tok != Tok_RightBrace && tok != Tok_Eoi) { + if (tok == Tok_LeftParen) + parenLevel++; + else if (tok == Tok_RightParen) + parenLevel--; + else if (tok == Tok_Comma) { + if (parenLevel <= 0) + break; + } val.append(lexeme()); readToken(); }