Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the tools applications of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #ifndef QMLVISITOR_H |
43 | #define QMLVISITOR_H |
44 | |
45 | #include <QString> |
46 | #include "declarativeparser/qdeclarativejsastvisitor_p.h" |
47 | #include "node.h" |
48 | #include "tree.h" |
49 | |
50 | QT_BEGIN_NAMESPACE |
51 | |
52 | class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor |
53 | { |
54 | public: |
55 | enum ExtraType{ |
56 | Comment, |
57 | Pragma |
58 | }; |
59 | |
60 | QmlMarkupVisitor(const QString &code, |
61 | const QList<QDeclarativeJS::AST::SourceLocation> &pragmas, |
62 | QDeclarativeJS::Engine *engine); |
63 | virtual ~QmlMarkupVisitor(); |
64 | |
65 | QString markedUpCode(); |
66 | |
67 | virtual bool visit(QDeclarativeJS::AST::UiImport *); |
68 | virtual void endVisit(QDeclarativeJS::AST::UiImport *); |
69 | |
70 | virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); |
71 | virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); |
72 | |
73 | virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); |
74 | virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); |
75 | |
76 | virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); |
77 | virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); |
78 | virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); |
79 | virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); |
80 | virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); |
81 | |
82 | virtual bool visit(QDeclarativeJS::AST::UiSignature *); |
83 | virtual void endVisit(QDeclarativeJS::AST::UiSignature *); |
84 | |
85 | virtual bool visit(QDeclarativeJS::AST::UiFormal *); |
86 | virtual bool visit(QDeclarativeJS::AST::ThisExpression *); |
87 | virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); |
88 | virtual bool visit(QDeclarativeJS::AST::NullExpression *); |
89 | virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); |
90 | virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); |
91 | virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); |
92 | virtual bool visit(QDeclarativeJS::AST::StringLiteral *); |
93 | virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); |
94 | virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); |
95 | |
96 | virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); |
97 | virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); |
98 | |
99 | virtual bool visit(QDeclarativeJS::AST::ElementList *); |
100 | virtual bool visit(QDeclarativeJS::AST::Elision *); |
101 | virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); |
102 | virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); |
103 | virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); |
104 | virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); |
105 | virtual bool visit(QDeclarativeJS::AST::NewExpression *); |
106 | virtual bool visit(QDeclarativeJS::AST::ArgumentList *); |
107 | virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); |
108 | virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); |
109 | virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); |
110 | virtual bool visit(QDeclarativeJS::AST::VoidExpression *); |
111 | virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); |
112 | virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); |
113 | virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); |
114 | virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); |
115 | virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); |
116 | virtual bool visit(QDeclarativeJS::AST::TildeExpression *); |
117 | virtual bool visit(QDeclarativeJS::AST::NotExpression *); |
118 | virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); |
119 | virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); |
120 | virtual bool visit(QDeclarativeJS::AST::Expression *); |
121 | |
122 | virtual bool visit(QDeclarativeJS::AST::Block *); |
123 | virtual void endVisit(QDeclarativeJS::AST::Block *); |
124 | |
125 | virtual bool visit(QDeclarativeJS::AST::VariableStatement *); |
126 | virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); |
127 | virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); |
128 | virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); |
129 | virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); |
130 | virtual bool visit(QDeclarativeJS::AST::IfStatement *); |
131 | virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); |
132 | virtual bool visit(QDeclarativeJS::AST::WhileStatement *); |
133 | virtual bool visit(QDeclarativeJS::AST::ForStatement *); |
134 | virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); |
135 | virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); |
136 | virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); |
137 | virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); |
138 | virtual bool visit(QDeclarativeJS::AST::BreakStatement *); |
139 | virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); |
140 | virtual bool visit(QDeclarativeJS::AST::WithStatement *); |
141 | |
142 | virtual bool visit(QDeclarativeJS::AST::CaseBlock *); |
143 | virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); |
144 | |
145 | virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); |
146 | virtual bool visit(QDeclarativeJS::AST::CaseClause *); |
147 | virtual bool visit(QDeclarativeJS::AST::DefaultClause *); |
148 | virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); |
149 | virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); |
150 | virtual bool visit(QDeclarativeJS::AST::TryStatement *); |
151 | virtual bool visit(QDeclarativeJS::AST::Catch *); |
152 | virtual bool visit(QDeclarativeJS::AST::Finally *); |
153 | virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); |
154 | virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); |
155 | virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); |
156 | virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); |
157 | |
158 | protected: |
159 | QString protect(const QString &string); |
160 | |
161 | private: |
162 | typedef QHash<QString, QString> StringHash; |
163 | void addExtra(quint32 start, quint32 finish); |
164 | void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, |
165 | const QString &text, |
166 | const StringHash &attributes = StringHash()); |
167 | void addVerbatim(QDeclarativeJS::AST::SourceLocation first, |
168 | QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); |
169 | QString sourceText(QDeclarativeJS::AST::SourceLocation &location); |
170 | |
171 | QDeclarativeJS::Engine *engine; |
172 | QList<ExtraType> extraTypes; |
173 | QList<QDeclarativeJS::AST::SourceLocation> extraLocations; |
174 | QString source; |
175 | QString output; |
176 | quint32 cursor; |
177 | int extraIndex; |
178 | }; |
179 | |
180 | QT_END_NAMESPACE |
181 | |
182 | #endif |
183 |
Warning: That file was not part of the compilation database. It may have many parsing errors.