Mercurial > projects > qtd
annotate generator/parser/binder.h @ 314:80b52f5e97b6 lifetime
Structure without common root dir
author | maxter <spambox@d-coding.com> |
---|---|
date | Wed, 23 Dec 2009 23:17:36 +0200 |
parents | 09a0f1d048f2 |
children |
rev | line source |
---|---|
1 | 1 /**************************************************************************** |
2 ** | |
52
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
3 ** Copyright (C) 1992-2009 Nokia. All rights reserved. |
1 | 4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org> |
5 ** | |
6 ** This file is part of Qt Jambi. | |
7 ** | |
52
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
8 ** Commercial Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
9 Licensees holding valid Qt Commercial licenses may use this file in |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
10 accordance with the Qt Commercial License Agreement provided with the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
11 Software or, alternatively, in accordance with the terms contained in |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
12 a written agreement between you and Nokia. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
13 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
14 GNU Lesser General Public License Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
15 Alternatively, this file may be used under the terms of the GNU Lesser |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
16 General Public License version 2.1 as published by the Free Software |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
17 Foundation and appearing in the file LICENSE.LGPL included in the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
18 packaging of this file. Please review the following information to |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
19 ensure the GNU Lesser General Public License version 2.1 requirements |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
20 will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
21 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
22 In addition, as a special exception, Nokia gives you certain |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
23 additional rights. These rights are described in the Nokia Qt LGPL |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
24 Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
25 package. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
26 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
27 GNU General Public License Usage |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
28 Alternatively, this file may be used under the terms of the GNU |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
29 General Public License version 3.0 as published by the Free Software |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
30 Foundation and appearing in the file LICENSE.GPL included in the |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
31 packaging of this file. Please review the following information to |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
32 ensure the GNU General Public License version 3.0 requirements will be |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
33 met: http://www.gnu.org/copyleft/gpl.html. |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
34 |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
35 If you are unsure which license is appropriate for your use, please |
09a0f1d048f2
update parser to that from jambi 4.5, attemt to fix building with gcc 4.4
eldar
parents:
1
diff
changeset
|
36 contact the sales department at qt-sales@nokia.com. |
1 | 37 |
38 ** | |
39 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | |
40 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
41 ** | |
42 ****************************************************************************/ | |
43 | |
44 | |
45 #ifndef BINDER_H | |
46 #define BINDER_H | |
47 | |
48 #include "default_visitor.h" | |
49 #include "codemodel.h" | |
50 #include "type_compiler.h" | |
51 #include "name_compiler.h" | |
52 #include "declarator_compiler.h" | |
53 | |
54 class TokenStream; | |
55 class LocationManager; | |
56 class Control; | |
57 struct NameSymbol; | |
58 | |
59 typedef void (*MessageHandler)(const std::string &s); | |
60 | |
61 class Binder: protected DefaultVisitor | |
62 { | |
63 public: | |
64 Binder(CodeModel *__model, LocationManager &__location, Control *__control = 0); | |
65 virtual ~Binder(); | |
66 | |
67 inline TokenStream *tokenStream() const { return _M_token_stream; } | |
68 inline CodeModel *model() const { return _M_model; } | |
69 ScopeModelItem currentScope(); | |
70 | |
71 FileModelItem run(AST *node); | |
72 | |
73 // utils | |
74 TypeInfo qualifyType(const TypeInfo &type, const QStringList &context) const; | |
75 | |
76 static void installMessageHandler(MessageHandler handler); | |
77 | |
78 protected: | |
79 virtual void visitAccessSpecifier(AccessSpecifierAST *); | |
80 virtual void visitClassSpecifier(ClassSpecifierAST *); | |
81 virtual void visitEnumSpecifier(EnumSpecifierAST *); | |
82 virtual void visitEnumerator(EnumeratorAST *); | |
83 virtual void visitFunctionDefinition(FunctionDefinitionAST *); | |
84 virtual void visitLinkageSpecification(LinkageSpecificationAST *); | |
85 virtual void visitNamespace(NamespaceAST *); | |
86 virtual void visitSimpleDeclaration(SimpleDeclarationAST *); | |
87 virtual void visitTemplateDeclaration(TemplateDeclarationAST *); | |
88 virtual void visitTypedef(TypedefAST *); | |
89 virtual void visitUsing(UsingAST *); | |
90 virtual void visitUsingDirective(UsingDirectiveAST *); | |
91 virtual void visitQProperty(QPropertyAST *); | |
92 virtual void visitForwardDeclarationSpecifier(ForwardDeclarationSpecifierAST *); | |
93 virtual void visitQEnums(QEnumsAST *); | |
94 | |
95 private: | |
96 | |
97 int decode_token(std::size_t index) const; | |
98 const NameSymbol *decode_symbol(std::size_t index) const; | |
99 CodeModel::AccessPolicy decode_access_policy(std::size_t index) const; | |
100 CodeModel::ClassType decode_class_type(std::size_t index) const; | |
101 | |
102 CodeModel::FunctionType changeCurrentFunctionType(CodeModel::FunctionType functionType); | |
103 CodeModel::AccessPolicy changeCurrentAccess(CodeModel::AccessPolicy accessPolicy); | |
104 NamespaceModelItem changeCurrentNamespace(NamespaceModelItem item); | |
105 ClassModelItem changeCurrentClass(ClassModelItem item); | |
106 FunctionDefinitionModelItem changeCurrentFunction(FunctionDefinitionModelItem item); | |
107 TemplateParameterList changeTemplateParameters(TemplateParameterList templateParameters); | |
108 | |
109 void declare_symbol(SimpleDeclarationAST *node, InitDeclaratorAST *init_declarator); | |
110 | |
111 void applyStorageSpecifiers(const ListNode<std::size_t> *storage_specifiers, MemberModelItem item); | |
112 void applyFunctionSpecifiers(const ListNode<std::size_t> *it, FunctionModelItem item); | |
113 | |
114 void updateItemPosition(CodeModelItem item, AST *node); | |
115 | |
116 private: | |
117 CodeModel *_M_model; | |
118 LocationManager &_M_location; | |
119 TokenStream *_M_token_stream; | |
120 Control *_M_control; | |
121 | |
122 CodeModel::FunctionType _M_current_function_type; | |
123 CodeModel::AccessPolicy _M_current_access; | |
124 FileModelItem _M_current_file; | |
125 NamespaceModelItem _M_current_namespace; | |
126 ClassModelItem _M_current_class; | |
127 FunctionDefinitionModelItem _M_current_function; | |
128 EnumModelItem _M_current_enum; | |
129 QStringList _M_context; | |
130 TemplateParameterList _M_current_template_parameters; // ### check me | |
131 QHash<QString, QString> _M_qualified_types; | |
132 QHash<QString, int> _M_anonymous_enums; | |
133 | |
134 static MessageHandler _M_message_handler; | |
135 | |
136 protected: | |
137 TypeCompiler type_cc; | |
138 NameCompiler name_cc; | |
139 DeclaratorCompiler decl_cc; | |
140 }; | |
141 | |
142 #endif // BINDER_H | |
143 | |
144 // kate: space-indent on; indent-width 2; replace-tabs on; |