diff options
author | Martin Smith <martin.smith@qt.io> | 2017-02-28 11:48:31 +0100 |
---|---|---|
committer | Martin Smith <martin.smith@qt.io> | 2017-08-10 07:34:37 +0000 |
commit | d40aac3a115e5ac8cfc11df74384a4900959a962 (patch) | |
tree | 682c80c759eefc2ad3c2e2dfb9299d0f0f893669 | |
parent | 61d6c6c6f6fba869781ec05c787606f7a72d6314 (diff) | |
download | qttools-d40aac3a115e5ac8cfc11df74384a4900959a962.tar.gz |
qdoc: Teach parser for \fn commands to parse array parameters
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ƶ <topi.reinio@qt.io>
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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(); |