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

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