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