39 static const Keyword pp_keywords[] = {
45 {
"\n",
"PP_NEWLINE"},
46 {
"#define",
"PP_DEFINE"},
48 {
"#undef",
"PP_UNDEF"},
49 {
"#ifdef",
"PP_IFDEF"},
50 {
"#ifndef",
"PP_IFNDEF"},
51 {
"#elif",
"PP_ELIF"},
52 {
"#else",
"PP_ELSE"},
53 {
"#endif",
"PP_ENDIF"},
54 {
"#include",
"PP_INCLUDE"},
55 {
"defined",
"PP_DEFINED"},
60 {
"%",
"PP_PERCENT" },
63 {
"bitand",
"PP_AND" },
67 {
"compl",
"PP_TILDE" },
74 {
"not_eq",
"PP_NE" },
77 {
"&&",
"PP_ANDAND" },
79 {
"?",
"PP_QUESTION" },
81 {
"##",
"PP_HASHHASH"},
82 {
"%:%:",
"PP_HASHHASH"},
85 {
"\'",
"PP_SINGLEQUOTE"},
86 {
" ",
"PP_WHITESPACE" },
87 {
"\t",
"PP_WHITESPACE" },
88 {
"//",
"PP_CPP_COMMENT" },
89 {
"/*",
"PP_C_COMMENT" },
90 {
"\\",
"PP_BACKSLASH" },
94 static const Keyword keywords[] = {
105 {
"<::",
"LANGLE_SCOPE" },
117 {
"dynamic_cast",
"DYNAMIC_CAST" },
118 {
"static_cast",
"STATIC_CAST" },
119 {
"reinterpret_cast",
"REINTERPRET_CAST" },
120 {
"const_cast",
"CONST_CAST" },
121 {
"typeid",
"TYPEID" },
123 {
"template",
"TEMPLATE" },
124 {
"throw",
"THROW" },
126 {
"catch",
"CATCH" },
127 {
"typedef",
"TYPEDEF" },
128 {
"friend",
"FRIEND" },
129 {
"class",
"CLASS" },
130 {
"namespace",
"NAMESPACE" },
132 {
"struct",
"STRUCT" },
133 {
"union",
"UNION" },
134 {
"virtual",
"VIRTUAL" },
135 {
"private",
"PRIVATE" },
136 {
"protected",
"PROTECTED" },
137 {
"public",
"PUBLIC" },
138 {
"export",
"EXPORT" },
140 {
"register",
"REGISTER" },
141 {
"extern",
"EXTERN" },
142 {
"mutable",
"MUTABLE" },
144 {
"using",
"USING" },
145 {
"inline",
"INLINE" },
146 {
"explicit",
"EXPLICIT" },
147 {
"static",
"STATIC" },
148 {
"const",
"CONST" },
149 {
"volatile",
"VOLATILE" },
150 {
"operator",
"OPERATOR" },
151 {
"sizeof",
"SIZEOF" },
153 {
"delete",
"DELETE" },
165 {
"compl",
"TILDE" },
169 {
"-=",
"MINUS_EQ" },
171 {
"/=",
"SLASH_EQ" },
172 {
"%=",
"PERCENT_EQ" },
178 {
">>=",
"GTGT_EQ" },
179 {
"<<=",
"LTLT_EQ" },
190 {
"->*",
"ARROW_STAR" },
193 {
"wchar",
"WCHAR" },
195 {
"short",
"SHORT" },
198 {
"signed",
"SIGNED" },
199 {
"unsigned",
"UNSIGNED" },
200 {
"float",
"FLOAT" },
201 {
"double",
"DOUBLE" },
204 {
"default",
"DEFAULT" },
207 {
"switch",
"SWITCH" },
208 {
"while",
"WHILE" },
211 {
"break",
"BREAK" },
212 {
"continue",
"CONTINUE" },
214 {
"return",
"RETURN" },
215 {
"Q_OBJECT",
"Q_OBJECT_TOKEN" },
216 {
"Q_NAMESPACE",
"Q_NAMESPACE_TOKEN" },
217 {
"Q_NAMESPACE_EXPORT",
"Q_NAMESPACE_EXPORT_TOKEN" },
218 {
"Q_GADGET",
"Q_GADGET_TOKEN" },
219 {
"Q_GADGET_EXPORT",
"Q_GADGET_EXPORT_TOKEN" },
220 {
"Q_PROPERTY",
"Q_PROPERTY_TOKEN" },
221 {
"Q_PLUGIN_METADATA",
"Q_PLUGIN_METADATA_TOKEN" },
222 {
"Q_ENUMS",
"Q_ENUMS_TOKEN" },
223 {
"Q_ENUM",
"Q_ENUM_TOKEN" },
224 {
"Q_ENUM_NS",
"Q_ENUM_NS_TOKEN" },
225 {
"Q_FLAGS",
"Q_FLAGS_TOKEN" },
226 {
"Q_FLAG",
"Q_FLAG_TOKEN" },
227 {
"Q_FLAG_NS",
"Q_FLAG_NS_TOKEN" },
228 {
"Q_DECLARE_FLAGS",
"Q_DECLARE_FLAGS_TOKEN" },
229 {
"Q_DECLARE_INTERFACE",
"Q_DECLARE_INTERFACE_TOKEN" },
230 {
"Q_DECLARE_METATYPE",
"Q_DECLARE_METATYPE_TOKEN" },
231 {
"Q_DECLARE_EXTENSION_INTERFACE",
"Q_DECLARE_INTERFACE_TOKEN" },
232 {
"Q_SETS",
"Q_FLAGS_TOKEN" },
233 {
"Q_CLASSINFO",
"Q_CLASSINFO_TOKEN" },
234 {
"Q_INTERFACES",
"Q_INTERFACES_TOKEN" },
235 {
"signals",
"SIGNALS" },
236 {
"slots",
"SLOTS" },
237 {
"Q_SIGNALS",
"Q_SIGNALS_TOKEN" },
238 {
"Q_SLOTS",
"Q_SLOTS_TOKEN" },
239 {
"Q_PRIVATE_SLOT",
"Q_PRIVATE_SLOT_TOKEN" },
240 {
"QT_MOC_COMPAT",
"Q_MOC_COMPAT_TOKEN" },
241 {
"Q_INVOKABLE",
"Q_INVOKABLE_TOKEN" },
242 {
"Q_SIGNAL",
"Q_SIGNAL_TOKEN" },
243 {
"Q_SLOT",
"Q_SLOT_TOKEN" },
244 {
"Q_SCRIPTABLE",
"Q_SCRIPTABLE_TOKEN" },
245 {
"Q_PRIVATE_PROPERTY",
"Q_PRIVATE_PROPERTY_TOKEN" },
246 {
"Q_REVISION",
"Q_REVISION_TOKEN" },
247 {
"Q_MOC_INCLUDE",
"Q_MOC_INCLUDE_TOKEN" },
250 {
"\'",
"SINGLEQUOTE" },
251 {
" ",
"WHITESPACE" },
252 {
"\t",
"WHITESPACE" },
254 {
"##",
"PP_HASHHASH" },
255 {
"\\",
"BACKSLASH" },
256 {
"//",
"CPP_COMMENT" },
257 {
"/*",
"C_COMMENT" },
264 return ((
s >=
'a' &&
s <=
'z')
265 || (
s >=
'A' &&
s <=
'Z')
266 ||
s ==
'_' ||
s ==
'$'
272 return ((
s >=
'a' &&
s <=
'z')
273 || (
s >=
'A' &&
s <=
'Z')
274 || (
s >=
'0' &&
s <=
'9')
275 ||
s ==
'_' ||
s ==
'$'
305 const char *
ident =
nullptr;
307 ident = pre?
"PP_CHARACTER" :
"CHARACTER";
308 else if (*lexem ==
'#')
309 ident = pre?
"PP_HASH" :
"HASH";
315 const char *
t =
nullptr;
319 t = pre?
"PP_INCOMPLETE":
"INCOMPLETE";
349 bool pre = (keywords == pp_keywords);
354 for (
c =
'a';
c <=
'z'; ++
c)
356 for (
c =
'A';
c <=
'Z'; ++
c)
363 for (
c =
'0';
c <=
'9'; ++
c)
371 for (
c =
'0';
c <=
'9'; ++
c)
380 for (
c = 0;
c < 128; ++
c)
392 states[
i].nextindex = ++transindex;
401 for (k = 0; k <
states.size(); ++k) {
406 for (
c = 0;
c < 128; ++
c) {
419 printf(
"static const short %skeyword_trans[][128] = {\n",
424 printf(
"%s {",
i?
",\n":
"");
425 for (
c = 0;
c < 128; ++
c)
428 (!
c ||
c%16)?
"":
"\n ",
435 printf(
"static const struct\n{\n"
441 "} %skeywords[] = {\n",
446 printf(
"%s {%s, %d, %d, %d, %s}",
459 printf(
"// auto generated\n"
460 "// DO NOT EDIT.\n\n");
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
bool is_ident_char(char s)
int main(int argc, char **)
[1]
void makeTable(const Keyword keywords[])
bool is_ident_start(char s)
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
bool operator==(const State &o) const