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 test suite 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 | /* NOTE: This file is AUTO GENERATED by qtokenautomaton2cpp.xsl. */ |
29 | |
30 | #include "withNamespace.h" |
31 | |
32 | QT_BEGIN_NAMESPACE |
33 | |
34 | using namespace TheNamespace; |
35 | |
36 | WithNamespace::Token WithNamespace::classifier3(const QChar *data) |
37 | |
38 | { |
39 | if (data[0].unicode() == 100) |
40 | |
41 | |
42 | { |
43 | |
44 | static const unsigned short string[] = |
45 | { |
46 | 101, 102 |
47 | }; |
48 | if(memcmp(s1: &data[1], s2: &string, n: sizeof(QChar) * 2) == 0) |
49 | |
50 | |
51 | return _111; |
52 | |
53 | } |
54 | |
55 | else if (data[0].unicode() == 97) |
56 | |
57 | |
58 | { |
59 | |
60 | static const unsigned short string[] = |
61 | { |
62 | 98, 99 |
63 | }; |
64 | if(memcmp(s1: &data[1], s2: &string, n: sizeof(QChar) * 2) == 0) |
65 | |
66 | |
67 | return _; |
68 | |
69 | } |
70 | |
71 | else if (data[0].unicode() == 103) |
72 | |
73 | |
74 | { |
75 | |
76 | static const unsigned short string[] = |
77 | { |
78 | 104, 105 |
79 | }; |
80 | if(memcmp(s1: &data[1], s2: &string, n: sizeof(QChar) * 2) == 0) |
81 | |
82 | |
83 | return wobbly; |
84 | |
85 | } |
86 | |
87 | |
88 | |
89 | return NoKeyword; |
90 | } |
91 | WithNamespace::Token WithNamespace::classifier4(const QChar *data) |
92 | |
93 | { |
94 | if (data[0].unicode() == 70) |
95 | |
96 | |
97 | { |
98 | if (data[1].unicode() == 70) |
99 | |
100 | |
101 | { |
102 | if (data[2].unicode() == 70) |
103 | |
104 | |
105 | { |
106 | if (data[3].unicode() == 70) |
107 | |
108 | |
109 | { |
110 | |
111 | |
112 | return FFFF; |
113 | |
114 | } |
115 | |
116 | else if (data[3].unicode() == 71) |
117 | |
118 | |
119 | { |
120 | |
121 | |
122 | return FFFG; |
123 | |
124 | } |
125 | |
126 | |
127 | } |
128 | |
129 | else if (data[2].unicode() == 71) |
130 | |
131 | |
132 | { |
133 | if (data[3].unicode() == 70) |
134 | |
135 | |
136 | { |
137 | |
138 | |
139 | return FFGF; |
140 | |
141 | } |
142 | |
143 | else if (data[3].unicode() == 71) |
144 | |
145 | |
146 | { |
147 | |
148 | |
149 | return FFGG; |
150 | |
151 | } |
152 | |
153 | |
154 | } |
155 | |
156 | else if (data[2].unicode() == 76) |
157 | |
158 | |
159 | { |
160 | |
161 | if (data[3].unicode() == 77) |
162 | |
163 | |
164 | return FFLM; |
165 | |
166 | } |
167 | |
168 | |
169 | } |
170 | |
171 | |
172 | } |
173 | |
174 | |
175 | |
176 | return NoKeyword; |
177 | } |
178 | WithNamespace::Token WithNamespace::classifier14(const QChar *data) |
179 | |
180 | { |
181 | if (data[0].unicode() == 119) |
182 | |
183 | |
184 | { |
185 | |
186 | static const unsigned short string[] = |
187 | { |
188 | 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115 |
189 | }; |
190 | if(memcmp(s1: &data[1], s2: &string, n: sizeof(QChar) * 13) == 0) |
191 | |
192 | |
193 | return WeHaveDashes; |
194 | |
195 | } |
196 | |
197 | else if (data[0].unicode() == 99) |
198 | |
199 | |
200 | { |
201 | |
202 | static const unsigned short string[] = |
203 | { |
204 | 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58 |
205 | }; |
206 | if(memcmp(s1: &data[1], s2: &string, n: sizeof(QChar) * 13) == 0) |
207 | |
208 | |
209 | return ColonInName; |
210 | |
211 | } |
212 | |
213 | |
214 | |
215 | return NoKeyword; |
216 | } |
217 | WithNamespace::Token WithNamespace::classifier15(const QChar *data) |
218 | |
219 | { |
220 | |
221 | static const unsigned short string[] = |
222 | { |
223 | 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45 |
224 | }; |
225 | if(memcmp(s1: &data[0], s2: &string, n: sizeof(QChar) * 15) == 0) |
226 | |
227 | |
228 | return WeHaveDashes2; |
229 | |
230 | |
231 | return NoKeyword; |
232 | } |
233 | WithNamespace::Token WithNamespace::classifier44(const QChar *data) |
234 | |
235 | { |
236 | |
237 | static const unsigned short string[] = |
238 | { |
239 | 97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119 |
240 | }; |
241 | if(memcmp(s1: &data[0], s2: &string, n: sizeof(QChar) * 44) == 0) |
242 | |
243 | |
244 | return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
245 | |
246 | |
247 | return NoKeyword; |
248 | } |
249 | WithNamespace::Token WithNamespace::toToken(const QChar *data, int length) |
250 | { |
251 | switch(length) |
252 | { |
253 | |
254 | case 3: |
255 | return classifier3(data); |
256 | |
257 | |
258 | case 4: |
259 | return classifier4(data); |
260 | |
261 | |
262 | case 14: |
263 | return classifier14(data); |
264 | |
265 | |
266 | case 15: |
267 | return classifier15(data); |
268 | |
269 | |
270 | case 44: |
271 | return classifier44(data); |
272 | |
273 | |
274 | default: |
275 | return NoKeyword; |
276 | } |
277 | } |
278 | |
279 | |
280 | QString WithNamespace::toString(Token token) |
281 | { |
282 | const unsigned short *data = 0; |
283 | int length = 0; |
284 | |
285 | switch(token) |
286 | { |
287 | |
288 | case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow: |
289 | { |
290 | static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] = |
291 | { |
292 | 97, 82, 101, 97, 108, 108, 121, 76, 111, 110, 103, 84, 111, 107, 101, 110, 73, 70, 114, 101, 97, 107, 105, 110, 77, 101, 97, 110, 73, 116, 85, 75, 110, 111, 119, 85, 75, 110, 111, 119, 75, 110, 111, 119, 0 |
293 | }; |
294 | data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
295 | length = 44; |
296 | break; |
297 | } |
298 | |
299 | case ColonInName: |
300 | { |
301 | static const unsigned short staticallyStoredColonInName[] = |
302 | { |
303 | 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0 |
304 | }; |
305 | data = staticallyStoredColonInName; |
306 | length = 14; |
307 | break; |
308 | } |
309 | |
310 | case FFFF: |
311 | { |
312 | static const unsigned short staticallyStoredFFFF[] = |
313 | { |
314 | 70, 70, 70, 70, 0 |
315 | }; |
316 | data = staticallyStoredFFFF; |
317 | length = 4; |
318 | break; |
319 | } |
320 | |
321 | case FFFG: |
322 | { |
323 | static const unsigned short staticallyStoredFFFG[] = |
324 | { |
325 | 70, 70, 70, 71, 0 |
326 | }; |
327 | data = staticallyStoredFFFG; |
328 | length = 4; |
329 | break; |
330 | } |
331 | |
332 | case FFGF: |
333 | { |
334 | static const unsigned short staticallyStoredFFGF[] = |
335 | { |
336 | 70, 70, 71, 70, 0 |
337 | }; |
338 | data = staticallyStoredFFGF; |
339 | length = 4; |
340 | break; |
341 | } |
342 | |
343 | case FFGG: |
344 | { |
345 | static const unsigned short staticallyStoredFFGG[] = |
346 | { |
347 | 70, 70, 71, 71, 0 |
348 | }; |
349 | data = staticallyStoredFFGG; |
350 | length = 4; |
351 | break; |
352 | } |
353 | |
354 | case FFLM: |
355 | { |
356 | static const unsigned short staticallyStoredFFLM[] = |
357 | { |
358 | 70, 70, 76, 77, 0 |
359 | }; |
360 | data = staticallyStoredFFLM; |
361 | length = 4; |
362 | break; |
363 | } |
364 | |
365 | case WeHaveDashes: |
366 | { |
367 | static const unsigned short staticallyStoredWeHaveDashes[] = |
368 | { |
369 | 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 0 |
370 | }; |
371 | data = staticallyStoredWeHaveDashes; |
372 | length = 14; |
373 | break; |
374 | } |
375 | |
376 | case WeHaveDashes2: |
377 | { |
378 | static const unsigned short staticallyStoredWeHaveDashes2[] = |
379 | { |
380 | 119, 101, 45, 104, 97, 118, 101, 45, 100, 97, 115, 104, 101, 115, 45, 0 |
381 | }; |
382 | data = staticallyStoredWeHaveDashes2; |
383 | length = 15; |
384 | break; |
385 | } |
386 | |
387 | case _: |
388 | { |
389 | static const unsigned short staticallyStored_[] = |
390 | { |
391 | 97, 98, 99, 0 |
392 | }; |
393 | data = staticallyStored_; |
394 | length = 3; |
395 | break; |
396 | } |
397 | |
398 | case _111: |
399 | { |
400 | static const unsigned short staticallyStored_111[] = |
401 | { |
402 | 100, 101, 102, 0 |
403 | }; |
404 | data = staticallyStored_111; |
405 | length = 3; |
406 | break; |
407 | } |
408 | |
409 | case wobbly: |
410 | { |
411 | static const unsigned short staticallyStoredwobbly[] = |
412 | { |
413 | 103, 104, 105, 0 |
414 | }; |
415 | data = staticallyStoredwobbly; |
416 | length = 3; |
417 | break; |
418 | } |
419 | |
420 | default: |
421 | /* It's either the default token, or an undefined enum |
422 | * value. We silence a compiler warning, and return the |
423 | * empty string. */ |
424 | ; |
425 | } |
426 | |
427 | union |
428 | { |
429 | const unsigned short *data; |
430 | const QChar *asQChar; |
431 | } converter; |
432 | converter.data = data; |
433 | |
434 | return QString::fromRawData(converter.asQChar, size: length); |
435 | } |
436 | |
437 | QT_END_NAMESPACE |
438 | |
439 | |