From d40aac3a115e5ac8cfc11df74384a4900959a962 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 28 Feb 2017 11:48:31 +0100 Subject: qdoc: Teach parser for \fn commands to parse array parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old qdoc C++ parser is still used for parsing function signatures in \fn commands. The parser could not handle the case where a formal parameter is an array declaration. Now it parses the formal parameter, so the syntax errors have disappeared. But there is a separate problem involving the matching of the declaration to the same declaration in the header file, which is parsed by clang. However, this is a separate issue not addressed by this fix. Change-Id: I61be810b02ac50a6ee380664a41915cc85633c66 Reviewed-by: Topi Reiniƶ --- src/qdoc/cppcodeparser.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 8a149dec2..0cfde2c2c 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -1229,6 +1229,24 @@ bool CppCodeParser::matchDataType(CodeChunk *dataType, QString *var, bool qProp) if (varComment.exactMatch(previousLexeme())) *var = varComment.cap(1); } + else if (match(Tok_LeftParen)) { + *var = "("; + while (tok != Tok_RightParen && tok != Tok_Eoi) { + (*var).append(lexeme()); + readToken(); + } + (*var).append(")"); + readToken(); + if (match(Tok_LeftBracket)) { + (*var).append("["); + while (tok != Tok_RightBracket && tok != Tok_Eoi) { + (*var).append(lexeme()); + readToken(); + } + (*var).append("]"); + readToken(); + } + } else if (qProp && (match(Tok_default) || match(Tok_final) || match(Tok_override))) { // Hack to make 'default', 'final' and 'override' work again in Q_PROPERTY *var = previousLexeme(); -- cgit v1.2.1