1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef TOKEN_H
30#define TOKEN_H
31
32#include <QtCore/qglobal.h>
33
34QT_BEGIN_NAMESPACE
35
36#define FOR_ALL_TOKENS(F) \
37 F(NOTOKEN) \
38 F(IDENTIFIER) \
39 F(INTEGER_LITERAL) \
40 F(CHARACTER_LITERAL) \
41 F(STRING_LITERAL) \
42 F(BOOLEAN_LITERAL) \
43 F(HEADER_NAME) \
44 F(LANGLE) \
45 F(RANGLE) \
46 F(LPAREN) \
47 F(RPAREN) \
48 F(ELIPSIS) \
49 F(LBRACK) \
50 F(RBRACK) \
51 F(LBRACE) \
52 F(RBRACE) \
53 F(EQ) \
54 F(SCOPE) \
55 F(SEMIC) \
56 F(COLON) \
57 F(DOTSTAR) \
58 F(QUESTION) \
59 F(DOT) \
60 F(DYNAMIC_CAST) \
61 F(STATIC_CAST) \
62 F(REINTERPRET_CAST) \
63 F(CONST_CAST) \
64 F(TYPEID) \
65 F(THIS) \
66 F(TEMPLATE) \
67 F(THROW) \
68 F(TRY) \
69 F(CATCH) \
70 F(TYPEDEF) \
71 F(FRIEND) \
72 F(CLASS) \
73 F(NAMESPACE) \
74 F(ENUM) \
75 F(STRUCT) \
76 F(UNION) \
77 F(VIRTUAL) \
78 F(PRIVATE) \
79 F(PROTECTED) \
80 F(PUBLIC) \
81 F(EXPORT) \
82 F(AUTO) \
83 F(REGISTER) \
84 F(EXTERN) \
85 F(MUTABLE) \
86 F(ASM) \
87 F(USING) \
88 F(INLINE) \
89 F(EXPLICIT) \
90 F(STATIC) \
91 F(CONST) \
92 F(VOLATILE) \
93 F(OPERATOR) \
94 F(SIZEOF) \
95 F(NEW) \
96 F(DELETE) \
97 F(PLUS) \
98 F(MINUS) \
99 F(STAR) \
100 F(SLASH) \
101 F(PERCENT) \
102 F(HAT) \
103 F(AND) \
104 F(OR) \
105 F(TILDE) \
106 F(NOT) \
107 F(PLUS_EQ) \
108 F(MINUS_EQ) \
109 F(STAR_EQ) \
110 F(SLASH_EQ) \
111 F(PERCENT_EQ) \
112 F(HAT_EQ) \
113 F(AND_EQ) \
114 F(OR_EQ) \
115 F(LTLT) \
116 F(GTGT) \
117 F(GTGT_EQ) \
118 F(LTLT_EQ) \
119 F(EQEQ) \
120 F(NE) \
121 F(LE) \
122 F(GE) \
123 F(ANDAND) \
124 F(OROR) \
125 F(INCR) \
126 F(DECR) \
127 F(COMMA) \
128 F(ARROW_STAR) \
129 F(ARROW) \
130 F(CHAR) \
131 F(WCHAR) \
132 F(BOOL) \
133 F(SHORT) \
134 F(INT) \
135 F(LONG) \
136 F(SIGNED) \
137 F(UNSIGNED) \
138 F(FLOAT) \
139 F(DOUBLE) \
140 F(VOID) \
141 F(CASE) \
142 F(DEFAULT) \
143 F(IF) \
144 F(ELSE) \
145 F(SWITCH) \
146 F(WHILE) \
147 F(DO) \
148 F(FOR) \
149 F(BREAK) \
150 F(CONTINUE) \
151 F(GOTO) \
152 F(SIGNALS) \
153 F(SLOTS) \
154 F(RETURN) \
155 F(Q_OBJECT_TOKEN) \
156 F(Q_GADGET_TOKEN) \
157 F(Q_NAMESPACE_TOKEN) \
158 F(Q_NAMESPACE_EXPORT_TOKEN) \
159 F(Q_PROPERTY_TOKEN) \
160 F(Q_PLUGIN_METADATA_TOKEN) \
161 F(Q_ENUMS_TOKEN) \
162 F(Q_ENUM_TOKEN) \
163 F(Q_ENUM_NS_TOKEN) \
164 F(Q_FLAGS_TOKEN) \
165 F(Q_FLAG_TOKEN) \
166 F(Q_FLAG_NS_TOKEN) \
167 F(Q_DECLARE_FLAGS_TOKEN) \
168 F(Q_DECLARE_INTERFACE_TOKEN) \
169 F(Q_DECLARE_METATYPE_TOKEN) \
170 F(Q_CLASSINFO_TOKEN) \
171 F(Q_INTERFACES_TOKEN) \
172 F(Q_SIGNALS_TOKEN) \
173 F(Q_SLOTS_TOKEN) \
174 F(Q_SIGNAL_TOKEN) \
175 F(Q_SLOT_TOKEN) \
176 F(Q_PRIVATE_SLOT_TOKEN) \
177 F(Q_MOC_COMPAT_TOKEN) \
178 F(Q_INVOKABLE_TOKEN) \
179 F(Q_SCRIPTABLE_TOKEN) \
180 F(Q_PRIVATE_PROPERTY_TOKEN) \
181 F(Q_REVISION_TOKEN) \
182 F(SPECIAL_TREATMENT_MARK) \
183 F(MOC_INCLUDE_BEGIN) \
184 F(MOC_INCLUDE_END) \
185 F(CPP_COMMENT) \
186 F(C_COMMENT) \
187 F(FLOATING_LITERAL) \
188 F(HASH) \
189 F(QUOTE) \
190 F(SINGLEQUOTE) \
191 F(LANGLE_SCOPE) \
192 F(DIGIT) \
193 F(CHARACTER) \
194 F(NEWLINE) \
195 F(WHITESPACE) \
196 F(BACKSLASH) \
197 F(INCOMPLETE) \
198 F(PP_DEFINE) \
199 F(PP_UNDEF) \
200 F(PP_IF) \
201 F(PP_IFDEF) \
202 F(PP_IFNDEF) \
203 F(PP_ELIF) \
204 F(PP_ELSE) \
205 F(PP_ENDIF) \
206 F(PP_INCLUDE) \
207 F(PP_HASHHASH) \
208 F(PP_HASH) \
209 F(PP_DEFINED) \
210 F(PP_INCOMPLETE) \
211 F(PP_MOC_TRUE) \
212 F(PP_MOC_FALSE)
213
214
215enum Token {
216
217#define CREATE_ENUM_VALUE(Name) Name,
218 FOR_ALL_TOKENS(CREATE_ENUM_VALUE)
219#undef CREATE_ENUM_VALUE
220
221 // aliases
222 PP_AND = AND,
223 PP_ANDAND = ANDAND,
224 PP_BACKSLASH = BACKSLASH,
225 PP_CHARACTER = CHARACTER,
226 PP_CHARACTER_LITERAL = CHARACTER_LITERAL,
227 PP_COLON = COLON,
228 PP_COMMA = COMMA,
229 PP_CPP_COMMENT = CPP_COMMENT,
230 PP_C_COMMENT = C_COMMENT,
231 PP_DIGIT = DIGIT,
232 PP_EQEQ = EQEQ,
233 PP_FLOATING_LITERAL = FLOATING_LITERAL,
234 PP_GE = GE,
235 PP_GTGT = GTGT,
236 PP_HAT = HAT,
237 PP_IDENTIFIER = IDENTIFIER,
238 PP_INTEGER_LITERAL = INTEGER_LITERAL,
239 PP_LANGLE = LANGLE,
240 PP_LE = LE,
241 PP_LPAREN = LPAREN,
242 PP_LTLT = LTLT,
243 PP_MINUS = MINUS,
244 PP_NE = NE,
245 PP_NEWLINE = NEWLINE,
246 PP_NOTOKEN = NOTOKEN,
247 PP_NOT = NOT,
248 PP_OR = OR,
249 PP_OROR = OROR,
250 PP_PERCENT = PERCENT,
251 PP_PLUS = PLUS,
252 PP_QUESTION = QUESTION,
253 PP_QUOTE = QUOTE,
254 PP_RANGLE = RANGLE,
255 PP_RPAREN = RPAREN,
256 PP_SINGLEQUOTE = SINGLEQUOTE,
257 PP_SLASH = SLASH,
258 PP_STAR = STAR,
259 PP_STRING_LITERAL = STRING_LITERAL,
260 PP_TILDE = TILDE,
261 PP_WHITESPACE = WHITESPACE,
262 Q_META_TOKEN_BEGIN = Q_OBJECT_TOKEN,
263 Q_META_TOKEN_END = SPECIAL_TREATMENT_MARK
264};
265
266// for debugging only
267#if defined(DEBUG_MOC)
268const char *tokenTypeName(Token t);
269#endif
270
271typedef Token PP_Token;
272
273QT_END_NAMESPACE
274
275#endif // TOKEN_H
276

source code of qtbase/src/tools/moc/token.h