author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 18 | 2f34d5167611 |
child 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the tools applications of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
/* |
|
43 |
cppcodeparser.h |
|
44 |
*/ |
|
45 |
||
46 |
#ifndef CPPCODEPARSER_H |
|
47 |
#define CPPCODEPARSER_H |
|
48 |
||
49 |
#include <qregexp.h> |
|
50 |
||
51 |
#include "codeparser.h" |
|
52 |
#include "node.h" |
|
53 |
||
54 |
QT_BEGIN_NAMESPACE |
|
55 |
||
56 |
class ClassNode; |
|
57 |
class CodeChunk; |
|
58 |
class CppCodeParserPrivate; |
|
59 |
class FunctionNode; |
|
60 |
class InnerNode; |
|
61 |
class Tokenizer; |
|
62 |
||
63 |
class CppCodeParser : public CodeParser |
|
64 |
{ |
|
65 |
public: |
|
66 |
CppCodeParser(); |
|
67 |
~CppCodeParser(); |
|
68 |
||
69 |
virtual void initializeParser(const Config& config); |
|
70 |
virtual void terminateParser(); |
|
71 |
virtual QString language(); |
|
72 |
virtual QString headerFileNameFilter(); |
|
73 |
virtual QString sourceFileNameFilter(); |
|
74 |
virtual void parseHeaderFile(const Location& location, |
|
75 |
const QString& filePath, |
|
76 |
Tree *tree); |
|
77 |
virtual void parseSourceFile(const Location& location, |
|
78 |
const QString& filePath, |
|
79 |
Tree *tree); |
|
80 |
virtual void doneParsingHeaderFiles(Tree *tree); |
|
81 |
virtual void doneParsingSourceFiles(Tree *tree); |
|
82 |
||
83 |
const FunctionNode *findFunctionNode(const QString& synopsis, |
|
84 |
Tree *tree, |
|
85 |
Node *relative = 0, |
|
86 |
bool fuzzy = false); |
|
87 |
||
88 |
protected: |
|
89 |
virtual QSet<QString> topicCommands(); |
|
90 |
virtual Node *processTopicCommand(const Doc& doc, |
|
91 |
const QString& command, |
|
92 |
const QString& arg); |
|
93 |
#ifdef QDOC_QML |
|
94 |
// might need to implement this in QsCodeParser as well. |
|
95 |
virtual Node *processTopicCommandGroup(const Doc& doc, |
|
96 |
const QString& command, |
|
97 |
const QStringList& args); |
|
98 |
bool splitQmlPropertyArg(const Doc& doc, |
|
99 |
const QString& arg, |
|
100 |
QString& type, |
|
101 |
QString& element, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
QString& name); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
103 |
bool splitQmlMethodArg(const Doc& doc, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
104 |
const QString& arg, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
105 |
QString& type, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
106 |
QString& element); |
0 | 107 |
#endif |
108 |
virtual QSet<QString> otherMetaCommands(); |
|
109 |
virtual void processOtherMetaCommand(const Doc& doc, |
|
110 |
const QString& command, |
|
111 |
const QString& arg, |
|
112 |
Node *node); |
|
113 |
void processOtherMetaCommands(const Doc& doc, Node *node); |
|
114 |
||
115 |
private: |
|
116 |
void reset(Tree *tree); |
|
117 |
void readToken(); |
|
118 |
const Location& location(); |
|
119 |
QString previousLexeme(); |
|
120 |
QString lexeme(); |
|
121 |
bool match(int target); |
|
122 |
bool matchCompat(); |
|
123 |
bool matchTemplateAngles(CodeChunk *type = 0); |
|
124 |
bool matchTemplateHeader(); |
|
125 |
bool matchDataType(CodeChunk *type, QString *var = 0); |
|
126 |
bool matchParameter(FunctionNode *func); |
|
127 |
bool matchFunctionDecl(InnerNode *parent, |
|
128 |
QStringList *parentPathPtr = 0, |
|
129 |
FunctionNode **funcPtr = 0, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
const QString &templateStuff = QString(), |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
Node::Type type = Node::Function, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
bool attached = false); |
0 | 133 |
bool matchBaseSpecifier(ClassNode *classe, bool isClass); |
134 |
bool matchBaseList(ClassNode *classe, bool isClass); |
|
135 |
bool matchClassDecl(InnerNode *parent, |
|
136 |
const QString &templateStuff = QString()); |
|
137 |
bool matchNamespaceDecl(InnerNode *parent); |
|
138 |
bool matchUsingDecl(); |
|
139 |
bool matchEnumItem(InnerNode *parent, EnumNode *enume); |
|
140 |
bool matchEnumDecl(InnerNode *parent); |
|
141 |
bool matchTypedefDecl(InnerNode *parent); |
|
142 |
bool matchProperty(InnerNode *parent); |
|
143 |
bool matchDeclList(InnerNode *parent); |
|
144 |
bool matchDocsAndStuff(); |
|
145 |
bool makeFunctionNode(const QString &synopsis, |
|
146 |
QStringList *parentPathPtr, |
|
147 |
FunctionNode **funcPtr, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
InnerNode *root = 0, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
Node::Type type = Node::Function, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
bool attached = false); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
FunctionNode* makeFunctionNode(const Doc& doc, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
const QString& sig, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
InnerNode* parent, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
Node::Type type, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
bool attached, |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
QString qdoctag); |
0 | 157 |
void parseQiteratorDotH(const Location &location, const QString &filePath); |
158 |
void instantiateIteratorMacro(const QString &container, |
|
159 |
const QString &includeFile, |
|
160 |
const QString ¯oDef, |
|
161 |
Tree *tree); |
|
162 |
void createExampleFileNodes(FakeNode *fake); |
|
163 |
||
164 |
QMap<QString, Node::Type> nodeTypeMap; |
|
165 |
Tree *tre; |
|
166 |
Tokenizer *tokenizer; |
|
167 |
int tok; |
|
168 |
Node::Access access; |
|
169 |
FunctionNode::Metaness metaness; |
|
170 |
QString moduleName; |
|
171 |
QStringList lastPath; |
|
172 |
QRegExp varComment; |
|
173 |
QRegExp sep; |
|
174 |
||
175 |
QString sequentialIteratorDefinition; |
|
176 |
QString mutableSequentialIteratorDefinition; |
|
177 |
QString associativeIteratorDefinition; |
|
178 |
QString mutableAssociativeIteratorDefinition; |
|
179 |
QSet<QString> usedNamespaces; |
|
180 |
QMap<QString, QString> sequentialIteratorClasses; |
|
181 |
QMap<QString, QString> mutableSequentialIteratorClasses; |
|
182 |
QMap<QString, QString> associativeIteratorClasses; |
|
183 |
QMap<QString, QString> mutableAssociativeIteratorClasses; |
|
184 |
||
185 |
static QStringList exampleFiles; |
|
186 |
static QStringList exampleDirs; |
|
187 |
QString exampleNameFilter; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
QString exampleImageFilter; |
0 | 189 |
}; |
190 |
||
191 |
QT_END_NAMESPACE |
|
192 |
||
193 |
#endif |