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 <venugopal.shivashankar@digia.com>
This commit is contained in:
Martin Smith 2015-04-23 12:29:09 +02:00
parent dc5719a7c5
commit 74f28ef1ca

View File

@ -1781,10 +1781,18 @@ bool CppCodeParser::matchEnumItem(Aggregate *parent, EnumNode *enume)
QString name = previousLexeme(); QString name = previousLexeme();
CodeChunk val; CodeChunk val;
int parenLevel = 0;
if (match(Tok_Equal)) { if (match(Tok_Equal)) {
while (tok != Tok_Comma && tok != Tok_RightBrace && while (tok != Tok_RightBrace && tok != Tok_Eoi) {
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()); val.append(lexeme());
readToken(); readToken();
} }