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 "basicNamespace.h" |
31 | |
32 | QT_BEGIN_NAMESPACE |
33 | |
34 | using namespace BasicNamespace; |
35 | |
36 | Basic::Token Basic::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 | Basic::Token Basic::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 | Basic::Token Basic::classifier14(const QChar *data) |
179 | |
180 | { |
181 | |
182 | static const unsigned short string[] = |
183 | { |
184 | 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58 |
185 | }; |
186 | if(memcmp(s1: &data[0], s2: &string, n: sizeof(QChar) * 14) == 0) |
187 | |
188 | |
189 | return ColonInName; |
190 | |
191 | |
192 | return NoKeyword; |
193 | } |
194 | Basic::Token Basic::classifier44(const QChar *data) |
195 | |
196 | { |
197 | |
198 | static const unsigned short string[] = |
199 | { |
200 | 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 |
201 | }; |
202 | if(memcmp(s1: &data[0], s2: &string, n: sizeof(QChar) * 44) == 0) |
203 | |
204 | |
205 | return AReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
206 | |
207 | |
208 | return NoKeyword; |
209 | } |
210 | Basic::Token Basic::toToken(const QChar *data, int length) |
211 | { |
212 | switch(length) |
213 | { |
214 | |
215 | case 3: |
216 | return classifier3(data); |
217 | |
218 | |
219 | case 4: |
220 | return classifier4(data); |
221 | |
222 | |
223 | case 14: |
224 | return classifier14(data); |
225 | |
226 | |
227 | case 44: |
228 | return classifier44(data); |
229 | |
230 | |
231 | default: |
232 | return NoKeyword; |
233 | } |
234 | } |
235 | |
236 | |
237 | QString Basic::toString(Token token) |
238 | { |
239 | const unsigned short *data = 0; |
240 | int length = 0; |
241 | |
242 | switch(token) |
243 | { |
244 | |
245 | case AReallyLongTokenIFreakinMeanItUKnowUKnowKnow: |
246 | { |
247 | static const unsigned short staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow[] = |
248 | { |
249 | 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 |
250 | }; |
251 | data = staticallyStoredAReallyLongTokenIFreakinMeanItUKnowUKnowKnow; |
252 | length = 44; |
253 | break; |
254 | } |
255 | |
256 | case ColonInName: |
257 | { |
258 | static const unsigned short staticallyStoredColonInName[] = |
259 | { |
260 | 99, 111, 108, 111, 110, 58, 105, 110, 58, 110, 97, 109, 101, 58, 0 |
261 | }; |
262 | data = staticallyStoredColonInName; |
263 | length = 14; |
264 | break; |
265 | } |
266 | |
267 | case FFFF: |
268 | { |
269 | static const unsigned short staticallyStoredFFFF[] = |
270 | { |
271 | 70, 70, 70, 70, 0 |
272 | }; |
273 | data = staticallyStoredFFFF; |
274 | length = 4; |
275 | break; |
276 | } |
277 | |
278 | case FFFG: |
279 | { |
280 | static const unsigned short staticallyStoredFFFG[] = |
281 | { |
282 | 70, 70, 70, 71, 0 |
283 | }; |
284 | data = staticallyStoredFFFG; |
285 | length = 4; |
286 | break; |
287 | } |
288 | |
289 | case FFGF: |
290 | { |
291 | static const unsigned short staticallyStoredFFGF[] = |
292 | { |
293 | 70, 70, 71, 70, 0 |
294 | }; |
295 | data = staticallyStoredFFGF; |
296 | length = 4; |
297 | break; |
298 | } |
299 | |
300 | case FFGG: |
301 | { |
302 | static const unsigned short staticallyStoredFFGG[] = |
303 | { |
304 | 70, 70, 71, 71, 0 |
305 | }; |
306 | data = staticallyStoredFFGG; |
307 | length = 4; |
308 | break; |
309 | } |
310 | |
311 | case FFLM: |
312 | { |
313 | static const unsigned short staticallyStoredFFLM[] = |
314 | { |
315 | 70, 70, 76, 77, 0 |
316 | }; |
317 | data = staticallyStoredFFLM; |
318 | length = 4; |
319 | break; |
320 | } |
321 | |
322 | case _: |
323 | { |
324 | static const unsigned short staticallyStored_[] = |
325 | { |
326 | 97, 98, 99, 0 |
327 | }; |
328 | data = staticallyStored_; |
329 | length = 3; |
330 | break; |
331 | } |
332 | |
333 | case _111: |
334 | { |
335 | static const unsigned short staticallyStored_111[] = |
336 | { |
337 | 100, 101, 102, 0 |
338 | }; |
339 | data = staticallyStored_111; |
340 | length = 3; |
341 | break; |
342 | } |
343 | |
344 | case wobbly: |
345 | { |
346 | static const unsigned short staticallyStoredwobbly[] = |
347 | { |
348 | 103, 104, 105, 0 |
349 | }; |
350 | data = staticallyStoredwobbly; |
351 | length = 3; |
352 | break; |
353 | } |
354 | |
355 | default: |
356 | /* It's either the default token, or an undefined enum |
357 | * value. We silence a compiler warning, and return the |
358 | * empty string. */ |
359 | ; |
360 | } |
361 | |
362 | union |
363 | { |
364 | const unsigned short *data; |
365 | const QChar *asQChar; |
366 | } converter; |
367 | converter.data = data; |
368 | |
369 | return QString::fromRawData(converter.asQChar, size: length); |
370 | } |
371 | |
372 | QT_END_NAMESPACE |
373 | |
374 | |