cppdoxygen.cpp 76.1 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15
**
16
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
**
hjk's avatar
hjk committed
24 25
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29 30 31

#include "cppdoxygen.h"

32
#include <QString>
33

34
using namespace CppTools;
35 36

/*
37 38 39 40 41 42 43 44 45 46
  TODO:
    ~
    @
    $
    \
    #
    f[
    f]
    f$
*/
47

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
static const char *doxy_token_spell[] = {
    "identifier",
    "arg",
    "attention",
    "author",
    "callgraph",
    "code",
    "dot",
    "else",
    "endcode",
    "endcond",
    "enddot",
    "endhtmlonly",
    "endif",
    "endlatexonly",
    "endlink",
    "endmanonly",
    "endverbatim",
    "endxmlonly",
    "hideinitializer",
    "htmlonly",
    "interface",
    "internal",
    "invariant",
    "latexonly",
    "li",
    "manonly",
    "n",
    "nosubgrouping",
    "note",
    "only",
    "post",
    "pre",
    "remarks",
    "return",
    "returns",
    "sa",
    "see",
    "showinitializer",
    "since",
    "test",
    "todo",
    "verbatim",
    "warning",
    "xmlonly",
    "a",
    "addtogroup",
    "anchor",
    "b",
    "c",
    "class",
    "cond",
    "copydoc",
    "def",
    "dontinclude",
    "dotfile",
    "e",
    "elseif",
    "em",
    "enum",
    "example",
    "exception",
    "exceptions",
    "file",
    "htmlinclude",
    "if",
    "ifnot",
    "include",
    "link",
    "namespace",
    "p",
    "package",
    "ref",
    "relates",
    "relatesalso",
    "retval",
    "throw",
    "throws",
    "verbinclude",
    "version",
    "xrefitem",
    "param",
    "image",
    "defgroup",
    "page",
    "paragraph",
    "section",
    "struct",
    "subsection",
    "subsubsection",
    "union",
    "weakgroup",
    "addindex",
    "brief",
    "bug",
    "date",
    "deprecated",
    "fn",
    "ingroup",
    "line",
    "mainpage",
    "name",
    "overload",
    "par",
    "short",
    "skip",
    "skipline",
    "typedef",
    "until",
157
    "var",
Roberto Raggi's avatar
Roberto Raggi committed
158 159 160 161 162 163 164 165 166 167 168 169
    "abstract",
    "badcode",
    "basename",
    "bold",
    "caption",
    "chapter",
    "codeline",
    "dots",
    "endabstract",
    "endchapter",
    "endfootnote",
    "endlegalese",
170
    "endlist",
Roberto Raggi's avatar
Roberto Raggi committed
171 172 173 174 175 176 177 178 179
    "endomit",
    "endpart",
    "endquotation",
    "endraw",
    "endsection1",
    "endsection2",
    "endsection3",
    "endsection4",
    "endsidebar",
180
    "endtable",
Roberto Raggi's avatar
Roberto Raggi committed
181 182 183 184
    "expire",
    "footnote",
    "generatelist",
    "granularity",
185 186
    "header",
    "i",
Roberto Raggi's avatar
Roberto Raggi committed
187 188 189
    "index",
    "inlineimage",
    "keyword",
190
    "l",
Roberto Raggi's avatar
Roberto Raggi committed
191
    "legalese",
192
    "list",
Roberto Raggi's avatar
Roberto Raggi committed
193
    "meta",
194 195 196
    "newcode",
    "o",
    "oldcode",
Roberto Raggi's avatar
Roberto Raggi committed
197 198 199 200 201 202 203 204 205 206 207
    "omit",
    "omitvalue",
    "part",
    "printline",
    "printto",
    "printuntil",
    "quotation",
    "quotefile",
    "quotefromfile",
    "quotefunction",
    "raw",
208 209
    "row",
    "section1",
Roberto Raggi's avatar
Roberto Raggi committed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
    "section2",
    "section3",
    "section4",
    "sidebar",
    "skipto",
    "skipuntil",
    "snippet",
    "sub",
    "sup",
    "table",
    "tableofcontents",
    "target",
    "tt",
    "underline",
    "unicode",
    "value",
    "contentspage",
    "externalpage",
    "group",
    "headerfile",
    "indexpage",
    "inheaderfile",
    "macro",
    "module",
    "nextpage",
    "previouspage",
    "property",
    "reimp",
    "service",
    "startpage",
    "variable",
    "compat",
    "inmodule",
    "mainclass",
    "nonreentrant",
    "obsolete",
    "preliminary",
    "inpublicgroup",
    "reentrant",
    "subtitle",
    "threadsafe",
    "title",
    "corelib",
    "uitools",
    "gui",
    "network",
    "opengl",
    "qt3support",
    "svg",
    "sql",
    "qtestlib",
    "webkit",
    "xml"
263
};
264

265 266 267
const char *CppTools::doxygenTagSpell(int index)
{ return doxy_token_spell[index]; }

268
static inline int classify1(const QChar *s) {
269
  if (s[0].unicode() == 'a')
270
    return T_DOXY_A;
271
  else if (s[0].unicode() == 'b')
272
    return T_DOXY_B;
273
  else if (s[0].unicode() == 'c')
274
    return T_DOXY_C;
275
  else if (s[0].unicode() == 'e')
276
    return T_DOXY_E;
277
  else if (s[0].unicode() == 'i')
278
    return T_DOXY_I;
279
  else if (s[0].unicode() == 'l')
280
    return T_DOXY_L;
281
  else if (s[0].unicode() == 'n')
282
    return T_DOXY_N;
283
  else if (s[0].unicode() == 'o')
284
    return T_DOXY_O;
285
  else if (s[0].unicode() == 'p')
286 287 288 289 290 291
    return T_DOXY_P;
  return T_DOXY_IDENTIFIER;
}

static inline int classify2(const QChar *s) {
  if (s[0].unicode() == 'e') {
292
    if (s[1].unicode() == 'm')
293 294 295
      return T_DOXY_EM;
  }
  else if (s[0].unicode() == 'f') {
296
    if (s[1].unicode() == 'n')
297 298 299
      return T_DOXY_FN;
  }
  else if (s[0].unicode() == 'i') {
300
    if (s[1].unicode() == 'f')
301 302 303
      return T_DOXY_IF;
  }
  else if (s[0].unicode() == 'l') {
304
    if (s[1].unicode() == 'i')
305 306 307
      return T_DOXY_LI;
  }
  else if (s[0].unicode() == 's') {
308
    if (s[1].unicode() == 'a')
309 310
      return T_DOXY_SA;
  }
Roberto Raggi's avatar
Roberto Raggi committed
311
  else if (s[0].unicode() == 't') {
312
    if (s[1].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
313 314
      return T_DOXY_TT;
  }
315 316 317 318 319 320
  return T_DOXY_IDENTIFIER;
}

static inline int classify3(const QChar *s) {
  if (s[0].unicode() == 'a') {
    if (s[1].unicode() == 'r') {
321
      if (s[2].unicode() == 'g')
322 323 324 325 326
        return T_DOXY_ARG;
    }
  }
  else if (s[0].unicode() == 'b') {
    if (s[1].unicode() == 'u') {
327
      if (s[2].unicode() == 'g')
328 329 330 331 332
        return T_DOXY_BUG;
    }
  }
  else if (s[0].unicode() == 'd') {
    if (s[1].unicode() == 'e') {
333
      if (s[2].unicode() == 'f')
334 335 336
        return T_DOXY_DEF;
    }
    else if (s[1].unicode() == 'o') {
337
      if (s[2].unicode() == 't')
338 339 340
        return T_DOXY_DOT;
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
341 342
  else if (s[0].unicode() == 'g') {
    if (s[1].unicode() == 'u') {
343
      if (s[2].unicode() == 'i')
Roberto Raggi's avatar
Roberto Raggi committed
344 345 346
        return T_DOXY_GUI;
    }
  }
347 348
  else if (s[0].unicode() == 'p') {
    if (s[1].unicode() == 'a') {
349
      if (s[2].unicode() == 'r')
350 351 352
        return T_DOXY_PAR;
    }
    else if (s[1].unicode() == 'r') {
353
      if (s[2].unicode() == 'e')
354 355 356 357
        return T_DOXY_PRE;
    }
  }
  else if (s[0].unicode() == 'r') {
Roberto Raggi's avatar
Roberto Raggi committed
358
    if (s[1].unicode() == 'a') {
359
      if (s[2].unicode() == 'w')
Roberto Raggi's avatar
Roberto Raggi committed
360 361 362
        return T_DOXY_RAW;
    }
    else if (s[1].unicode() == 'e') {
363
      if (s[2].unicode() == 'f')
364 365
        return T_DOXY_REF;
    }
366
    else if (s[1].unicode() == 'o') {
367
      if (s[2].unicode() == 'w')
368 369
        return T_DOXY_ROW;
    }
370 371 372
  }
  else if (s[0].unicode() == 's') {
    if (s[1].unicode() == 'e') {
373
      if (s[2].unicode() == 'e')
374 375
        return T_DOXY_SEE;
    }
Roberto Raggi's avatar
Roberto Raggi committed
376
    else if (s[1].unicode() == 'q') {
377
      if (s[2].unicode() == 'l')
Roberto Raggi's avatar
Roberto Raggi committed
378 379 380
        return T_DOXY_SQL;
    }
    else if (s[1].unicode() == 'u') {
381
      if (s[2].unicode() == 'b')
Roberto Raggi's avatar
Roberto Raggi committed
382
        return T_DOXY_SUB;
383
      else if (s[2].unicode() == 'p')
Roberto Raggi's avatar
Roberto Raggi committed
384 385 386
        return T_DOXY_SUP;
    }
    else if (s[1].unicode() == 'v') {
387
      if (s[2].unicode() == 'g')
Roberto Raggi's avatar
Roberto Raggi committed
388 389
        return T_DOXY_SVG;
    }
390 391 392
  }
  else if (s[0].unicode() == 'v') {
    if (s[1].unicode() == 'a') {
393
      if (s[2].unicode() == 'r')
394 395 396
        return T_DOXY_VAR;
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
397 398
  else if (s[0].unicode() == 'x') {
    if (s[1].unicode() == 'm') {
399
      if (s[2].unicode() == 'l')
Roberto Raggi's avatar
Roberto Raggi committed
400 401 402
        return T_DOXY_XML;
    }
  }
403 404 405 406
  return T_DOXY_IDENTIFIER;
}

static inline int classify4(const QChar *s) {
Roberto Raggi's avatar
Roberto Raggi committed
407 408 409
  if (s[0].unicode() == 'b') {
    if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'l') {
410
        if (s[3].unicode() == 'd')
Roberto Raggi's avatar
Roberto Raggi committed
411 412 413 414 415
          return T_DOXY_BOLD;
      }
    }
  }
  else if (s[0].unicode() == 'c') {
416 417
    if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'd') {
418
        if (s[3].unicode() == 'e')
419 420 421
          return T_DOXY_CODE;
      }
      else if (s[2].unicode() == 'n') {
422
        if (s[3].unicode() == 'd')
423 424 425 426 427 428 429
          return T_DOXY_COND;
      }
    }
  }
  else if (s[0].unicode() == 'd') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 't') {
430
        if (s[3].unicode() == 'e')
431 432 433
          return T_DOXY_DATE;
      }
    }
Roberto Raggi's avatar
Roberto Raggi committed
434 435
    else if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 't') {
436
        if (s[3].unicode() == 's')
Roberto Raggi's avatar
Roberto Raggi committed
437 438 439
          return T_DOXY_DOTS;
      }
    }
440 441 442 443
  }
  else if (s[0].unicode() == 'e') {
    if (s[1].unicode() == 'l') {
      if (s[2].unicode() == 's') {
444
        if (s[3].unicode() == 'e')
445 446 447 448 449
          return T_DOXY_ELSE;
      }
    }
    else if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'u') {
450
        if (s[3].unicode() == 'm')
451 452 453 454 455 456 457
          return T_DOXY_ENUM;
      }
    }
  }
  else if (s[0].unicode() == 'f') {
    if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 'l') {
458
        if (s[3].unicode() == 'e')
459 460 461 462 463 464 465
          return T_DOXY_FILE;
      }
    }
  }
  else if (s[0].unicode() == 'l') {
    if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 'n') {
466
        if (s[3].unicode() == 'e')
467
          return T_DOXY_LINE;
468
        else if (s[3].unicode() == 'k')
469 470
          return T_DOXY_LINK;
      }
471
      else if (s[2].unicode() == 's') {
472
        if (s[3].unicode() == 't')
473 474
          return T_DOXY_LIST;
      }
475 476
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
477 478 479
  else if (s[0].unicode() == 'm') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 't') {
480
        if (s[3].unicode() == 'a')
Roberto Raggi's avatar
Roberto Raggi committed
481 482 483 484
          return T_DOXY_META;
      }
    }
  }
485 486 487
  else if (s[0].unicode() == 'n') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'm') {
488
        if (s[3].unicode() == 'e')
489 490 491 492 493
          return T_DOXY_NAME;
      }
    }
    else if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 't') {
494
        if (s[3].unicode() == 'e')
495 496 497 498 499
          return T_DOXY_NOTE;
      }
    }
  }
  else if (s[0].unicode() == 'o') {
Roberto Raggi's avatar
Roberto Raggi committed
500 501
    if (s[1].unicode() == 'm') {
      if (s[2].unicode() == 'i') {
502
        if (s[3].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
503 504 505 506
          return T_DOXY_OMIT;
      }
    }
    else if (s[1].unicode() == 'n') {
507
      if (s[2].unicode() == 'l') {
508
        if (s[3].unicode() == 'y')
509 510 511 512 513 514 515
          return T_DOXY_ONLY;
      }
    }
  }
  else if (s[0].unicode() == 'p') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'g') {
516
        if (s[3].unicode() == 'e')
517 518
          return T_DOXY_PAGE;
      }
Roberto Raggi's avatar
Roberto Raggi committed
519
      else if (s[2].unicode() == 'r') {
520
        if (s[3].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
521 522
          return T_DOXY_PART;
      }
523 524 525
    }
    else if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 's') {
526
        if (s[3].unicode() == 't')
527 528 529 530 531 532 533
          return T_DOXY_POST;
      }
    }
  }
  else if (s[0].unicode() == 's') {
    if (s[1].unicode() == 'k') {
      if (s[2].unicode() == 'i') {
534
        if (s[3].unicode() == 'p')
535 536 537 538 539 540 541
          return T_DOXY_SKIP;
      }
    }
  }
  else if (s[0].unicode() == 't') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 's') {
542
        if (s[3].unicode() == 't')
543 544 545 546 547
          return T_DOXY_TEST;
      }
    }
    else if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'd') {
548
        if (s[3].unicode() == 'o')
549 550 551 552 553 554 555 556 557 558 559 560
          return T_DOXY_TODO;
      }
    }
  }
  return T_DOXY_IDENTIFIER;
}

static inline int classify5(const QChar *s) {
  if (s[0].unicode() == 'b') {
    if (s[1].unicode() == 'r') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'e') {
561
          if (s[4].unicode() == 'f')
562 563 564 565 566 567 568 569 570
            return T_DOXY_BRIEF;
        }
      }
    }
  }
  else if (s[0].unicode() == 'c') {
    if (s[1].unicode() == 'l') {
      if (s[2].unicode() == 'a') {
        if (s[3].unicode() == 's') {
571
          if (s[4].unicode() == 's')
572 573 574 575 576 577 578 579 580
            return T_DOXY_CLASS;
        }
      }
    }
  }
  else if (s[0].unicode() == 'e') {
    if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'i') {
581
          if (s[4].unicode() == 'f')
582 583 584 585 586
            return T_DOXY_ENDIF;
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
587 588 589 590
  else if (s[0].unicode() == 'g') {
    if (s[1].unicode() == 'r') {
      if (s[2].unicode() == 'o') {
        if (s[3].unicode() == 'u') {
591
          if (s[4].unicode() == 'p')
Roberto Raggi's avatar
Roberto Raggi committed
592 593 594 595 596
            return T_DOXY_GROUP;
        }
      }
    }
  }
597 598 599 600
  else if (s[0].unicode() == 'i') {
    if (s[1].unicode() == 'f') {
      if (s[2].unicode() == 'n') {
        if (s[3].unicode() == 'o') {
601
          if (s[4].unicode() == 't')
602 603 604 605 606 607 608
            return T_DOXY_IFNOT;
        }
      }
    }
    else if (s[1].unicode() == 'm') {
      if (s[2].unicode() == 'a') {
        if (s[3].unicode() == 'g') {
609
          if (s[4].unicode() == 'e')
610 611 612 613
            return T_DOXY_IMAGE;
        }
      }
    }
Roberto Raggi's avatar
Roberto Raggi committed
614 615 616
    else if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'e') {
617
          if (s[4].unicode() == 'x')
Roberto Raggi's avatar
Roberto Raggi committed
618 619 620 621 622 623 624 625 626
            return T_DOXY_INDEX;
        }
      }
    }
  }
  else if (s[0].unicode() == 'm') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'c') {
        if (s[3].unicode() == 'r') {
627
          if (s[4].unicode() == 'o')
Roberto Raggi's avatar
Roberto Raggi committed
628 629 630 631
            return T_DOXY_MACRO;
        }
      }
    }
632 633 634 635 636
  }
  else if (s[0].unicode() == 'p') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'a') {
637
          if (s[4].unicode() == 'm')
638 639 640 641 642
            return T_DOXY_PARAM;
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
643 644 645 646
  else if (s[0].unicode() == 'r') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'm') {
647
          if (s[4].unicode() == 'p')
Roberto Raggi's avatar
Roberto Raggi committed
648 649 650 651 652
            return T_DOXY_REIMP;
        }
      }
    }
  }
653 654 655 656
  else if (s[0].unicode() == 's') {
    if (s[1].unicode() == 'h') {
      if (s[2].unicode() == 'o') {
        if (s[3].unicode() == 'r') {
657
          if (s[4].unicode() == 't')
658 659 660 661 662 663 664
            return T_DOXY_SHORT;
        }
      }
    }
    else if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 'n') {
        if (s[3].unicode() == 'c') {
665
          if (s[4].unicode() == 'e')
666 667 668 669 670 671
            return T_DOXY_SINCE;
        }
      }
    }
  }
  else if (s[0].unicode() == 't') {
672 673 674
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'b') {
        if (s[3].unicode() == 'l') {
675
          if (s[4].unicode() == 'e')
676 677 678 679 680
            return T_DOXY_TABLE;
        }
      }
    }
    else if (s[1].unicode() == 'h') {
681 682
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'o') {
683
          if (s[4].unicode() == 'w')
684 685 686 687
            return T_DOXY_THROW;
        }
      }
    }
Roberto Raggi's avatar
Roberto Raggi committed
688 689 690
    else if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'l') {
691
          if (s[4].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
692 693 694 695
            return T_DOXY_TITLE;
        }
      }
    }
696 697 698 699 700
  }
  else if (s[0].unicode() == 'u') {
    if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'o') {
701
          if (s[4].unicode() == 'n')
702 703 704 705 706
            return T_DOXY_UNION;
        }
      }
      else if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'i') {
707
          if (s[4].unicode() == 'l')
708 709 710 711 712
            return T_DOXY_UNTIL;
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
713 714 715 716
  else if (s[0].unicode() == 'v') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'l') {
        if (s[3].unicode() == 'u') {
717
          if (s[4].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
718 719 720 721 722
            return T_DOXY_VALUE;
        }
      }
    }
  }
723 724 725 726 727 728 729 730 731
  return T_DOXY_IDENTIFIER;
}

static inline int classify6(const QChar *s) {
  if (s[0].unicode() == 'a') {
    if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'c') {
        if (s[3].unicode() == 'h') {
          if (s[4].unicode() == 'o') {
732
            if (s[5].unicode() == 'r')
733 734 735 736 737 738 739 740 741
              return T_DOXY_ANCHOR;
          }
        }
      }
    }
    else if (s[1].unicode() == 'u') {
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'h') {
          if (s[4].unicode() == 'o') {
742
            if (s[5].unicode() == 'r')
743 744 745 746 747 748
              return T_DOXY_AUTHOR;
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
749 750 751 752 753
  else if (s[0].unicode() == 'c') {
    if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'm') {
        if (s[3].unicode() == 'p') {
          if (s[4].unicode() == 'a') {
754
            if (s[5].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
755 756 757 758 759 760
              return T_DOXY_COMPAT;
          }
        }
      }
    }
  }
761 762 763 764 765
  else if (s[0].unicode() == 'e') {
    if (s[1].unicode() == 'l') {
      if (s[2].unicode() == 's') {
        if (s[3].unicode() == 'e') {
          if (s[4].unicode() == 'i') {
766
            if (s[5].unicode() == 'f')
767 768 769 770 771 772 773 774 775
              return T_DOXY_ELSEIF;
          }
        }
      }
    }
    else if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'd') {
          if (s[4].unicode() == 'o') {
776
            if (s[5].unicode() == 't')
777 778 779
              return T_DOXY_ENDDOT;
          }
        }
Roberto Raggi's avatar
Roberto Raggi committed
780 781
        else if (s[3].unicode() == 'r') {
          if (s[4].unicode() == 'a') {
782
            if (s[5].unicode() == 'w')
Roberto Raggi's avatar
Roberto Raggi committed
783 784 785 786 787 788 789 790 791
              return T_DOXY_ENDRAW;
          }
        }
      }
    }
    else if (s[1].unicode() == 'x') {
      if (s[2].unicode() == 'p') {
        if (s[3].unicode() == 'i') {
          if (s[4].unicode() == 'r') {
792
            if (s[5].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
793 794 795
              return T_DOXY_EXPIRE;
          }
        }
796 797 798
      }
    }
  }
799 800 801 802 803
  else if (s[0].unicode() == 'h') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'a') {
        if (s[3].unicode() == 'd') {
          if (s[4].unicode() == 'e') {
804
            if (s[5].unicode() == 'r')
805 806 807 808 809 810
              return T_DOXY_HEADER;
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
811 812 813 814 815
  else if (s[0].unicode() == 'm') {
    if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'u') {
          if (s[4].unicode() == 'l') {
816
            if (s[5].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
817 818 819 820 821 822 823 824 825 826 827
              return T_DOXY_MODULE;
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'o') {
    if (s[1].unicode() == 'p') {
      if (s[2].unicode() == 'e') {
        if (s[3].unicode() == 'n') {
          if (s[4].unicode() == 'g') {
828
            if (s[5].unicode() == 'l')
Roberto Raggi's avatar
Roberto Raggi committed
829 830 831 832 833 834
              return T_DOXY_OPENGL;
          }
        }
      }
    }
  }
835 836 837 838 839
  else if (s[0].unicode() == 'r') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'u') {
          if (s[4].unicode() == 'r') {
840
            if (s[5].unicode() == 'n')
841 842 843 844 845
              return T_DOXY_RETURN;
          }
        }
        else if (s[3].unicode() == 'v') {
          if (s[4].unicode() == 'a') {
846
            if (s[5].unicode() == 'l')
847 848 849 850 851 852 853
              return T_DOXY_RETVAL;
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 's') {
Roberto Raggi's avatar
Roberto Raggi committed
854 855 856 857
    if (s[1].unicode() == 'k') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'p') {
          if (s[4].unicode() == 't') {
858
            if (s[5].unicode() == 'o')
Roberto Raggi's avatar
Roberto Raggi committed
859 860 861 862 863 864
              return T_DOXY_SKIPTO;
          }
        }
      }
    }
    else if (s[1].unicode() == 't') {
865 866 867
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'u') {
          if (s[4].unicode() == 'c') {
868
            if (s[5].unicode() == 't')
869 870 871 872 873 874 875
              return T_DOXY_STRUCT;
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 't') {
Roberto Raggi's avatar
Roberto Raggi committed
876
    if (s[1].unicode() == 'a') {
877
      if (s[2].unicode() == 'r') {
Roberto Raggi's avatar
Roberto Raggi committed
878 879
        if (s[3].unicode() == 'g') {
          if (s[4].unicode() == 'e') {
880
            if (s[5].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
881
              return T_DOXY_TARGET;
882 883 884 885
          }
        }
      }
    }
Roberto Raggi's avatar
Roberto Raggi committed
886 887 888 889
    else if (s[1].unicode() == 'h') {
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'o') {
          if (s[4].unicode() == 'w') {
890
            if (s[5].unicode() == 's')
Roberto Raggi's avatar
Roberto Raggi committed
891
              return T_DOXY_THROWS;
892 893 894 895 896
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
897 898 899 900
  else if (s[0].unicode() == 'w') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'b') {
        if (s[3].unicode() == 'k') {
901
          if (s[4].unicode() == 'i') {
902
            if (s[5].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
903
              return T_DOXY_WEBKIT;
904 905 906 907 908
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
909 910 911 912 913 914
  return T_DOXY_IDENTIFIER;
}

static inline int classify7(const QChar *s) {
  if (s[0].unicode() == 'b') {
    if (s[1].unicode() == 'a') {
915 916 917 918
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'c') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'd') {
919
              if (s[6].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
920
                return T_DOXY_BADCODE;
921 922 923
            }
          }
        }
Roberto Raggi's avatar
Roberto Raggi committed
924 925 926 927 928 929 930 931 932
      }
    }
  }
  else if (s[0].unicode() == 'c') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'p') {
        if (s[3].unicode() == 't') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'o') {
933
              if (s[6].unicode() == 'n')
Roberto Raggi's avatar
Roberto Raggi committed
934 935 936 937 938 939 940 941 942 943 944
                return T_DOXY_CAPTION;
            }
          }
        }
      }
    }
    else if (s[1].unicode() == 'h') {
      if (s[2].unicode() == 'a') {
        if (s[3].unicode() == 'p') {
          if (s[4].unicode() == 't') {
            if (s[5].unicode() == 'e') {
945
              if (s[6].unicode() == 'r')
Roberto Raggi's avatar
Roberto Raggi committed
946 947 948 949 950 951 952 953 954 955 956
                return T_DOXY_CHAPTER;
            }
          }
        }
      }
    }
    else if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 'p') {
        if (s[3].unicode() == 'y') {
          if (s[4].unicode() == 'd') {
            if (s[5].unicode() == 'o') {
957
              if (s[6].unicode() == 'c')
Roberto Raggi's avatar
Roberto Raggi committed
958 959 960 961 962 963 964 965 966
                return T_DOXY_COPYDOC;
            }
          }
        }
      }
      else if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'e') {
          if (s[4].unicode() == 'l') {
            if (s[5].unicode() == 'i') {
967
              if (s[6].unicode() == 'b')
Roberto Raggi's avatar
Roberto Raggi committed
968 969 970 971 972 973 974 975 976 977 978 979 980
                return T_DOXY_CORELIB;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'd') {
    if (s[1].unicode() == 'o') {
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'f') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'l') {
981
              if (s[6].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
982 983 984 985 986 987 988 989 990 991 992 993 994
                return T_DOXY_DOTFILE;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'e') {
    if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'c') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'd') {
995
              if (s[6].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
996 997 998
                return T_DOXY_ENDCODE;
            }
            else if (s[5].unicode() == 'n') {
999
              if (s[6].unicode() == 'd')
Roberto Raggi's avatar
Roberto Raggi committed
1000 1001 1002 1003 1004
                return T_DOXY_ENDCOND;
            }
          }
        }
        else if (s[3].unicode() == 'l') {
1005 1006
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'n') {
1007
              if (s[6].unicode() == 'k')
1008 1009
                return T_DOXY_ENDLINK;
            }
1010
            else if (s[5].unicode() == 's') {
1011
              if (s[6].unicode() == 't')
1012 1013
                return T_DOXY_ENDLIST;
            }
1014 1015
          }
        }
Roberto Raggi's avatar
Roberto Raggi committed
1016 1017 1018
        else if (s[3].unicode() == 'o') {
          if (s[4].unicode() == 'm') {
            if (s[5].unicode() == 'i') {
1019
              if (s[6].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
1020 1021 1022 1023 1024 1025 1026
                return T_DOXY_ENDOMIT;
            }
          }
        }
        else if (s[3].unicode() == 'p') {
          if (s[4].unicode() == 'a') {
            if (s[5].unicode() == 'r') {
1027
              if (s[6].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
1028 1029 1030 1031
                return T_DOXY_ENDPART;
            }
          }
        }
1032 1033 1034 1035 1036 1037 1038
      }
    }
    else if (s[1].unicode() == 'x') {
      if (s[2].unicode() == 'a') {
        if (s[3].unicode() == 'm') {
          if (s[4].unicode() == 'p') {
            if (s[5].unicode() == 'l') {
1039
              if (s[6].unicode() == 'e')
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052
                return T_DOXY_EXAMPLE;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'i') {
    if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'c') {
        if (s[3].unicode() == 'l') {
          if (s[4].unicode() == 'u') {
            if (s[5].unicode() == 'd') {
1053
              if (s[6].unicode() == 'e')
1054 1055 1056 1057 1058 1059 1060 1061 1062
                return T_DOXY_INCLUDE;
            }
          }
        }
      }
      else if (s[2].unicode() == 'g') {
        if (s[3].unicode() == 'r') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'u') {
1063
              if (s[6].unicode() == 'p')
1064 1065 1066 1067 1068 1069 1070
                return T_DOXY_INGROUP;
            }
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
1071 1072 1073 1074 1075 1076
  else if (s[0].unicode() == 'k') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'y') {
        if (s[3].unicode() == 'w') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'r') {
1077
              if (s[6].unicode() == 'd')
Roberto Raggi's avatar
Roberto Raggi committed
1078 1079 1080 1081 1082 1083 1084
                return T_DOXY_KEYWORD;
            }
          }
        }
      }
    }
  }
1085 1086 1087 1088 1089 1090
  else if (s[0].unicode() == 'm') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'n') {
        if (s[3].unicode() == 'o') {
          if (s[4].unicode() == 'n') {
            if (s[5].unicode() == 'l') {
1091
              if (s[6].unicode() == 'y')
1092 1093 1094 1095 1096 1097 1098
                return T_DOXY_MANONLY;
            }
          }
        }
      }
    }
  }
1099 1100
  else if (s[0].unicode() == 'n') {
    if (s[1].unicode() == 'e') {
Roberto Raggi's avatar
Roberto Raggi committed
1101 1102 1103 1104
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'w') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'r') {
1105
              if (s[6].unicode() == 'k')
Roberto Raggi's avatar
Roberto Raggi committed
1106 1107 1108 1109 1110 1111
                return T_DOXY_NETWORK;
            }
          }
        }
      }
      else if (s[2].unicode() == 'w') {
1112 1113 1114
        if (s[3].unicode() == 'c') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'd') {
1115
              if (s[6].unicode() == 'e')
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
                return T_DOXY_NEWCODE;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'o') {
    if (s[1].unicode() == 'l') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'c') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'd') {
1129
              if (s[6].unicode() == 'e')
1130 1131 1132 1133 1134 1135 1136
                return T_DOXY_OLDCODE;
            }
          }
        }
      }
    }
  }
1137 1138 1139 1140 1141 1142
  else if (s[0].unicode() == 'p') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'c') {
        if (s[3].unicode() == 'k') {
          if (s[4].unicode() == 'a') {
            if (s[5].unicode() == 'g') {
1143
              if (s[6].unicode() == 'e')
1144 1145 1146 1147 1148 1149
                return T_DOXY_PACKAGE;
            }
          }
        }
      }
    }
Roberto Raggi's avatar
Roberto Raggi committed
1150 1151 1152 1153 1154
    else if (s[1].unicode() == 'r') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'n') {
          if (s[4].unicode() == 't') {
            if (s[5].unicode() == 't') {
1155
              if (s[6].unicode() == 'o')
Roberto Raggi's avatar
Roberto Raggi committed
1156 1157 1158 1159 1160 1161
                return T_DOXY_PRINTTO;
            }
          }
        }
      }
    }
1162 1163 1164 1165 1166 1167 1168
  }
  else if (s[0].unicode() == 'r') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'l') {
        if (s[3].unicode() == 'a') {
          if (s[4].unicode() == 't') {
            if (s[5].unicode() == 'e') {
1169
              if (s[6].unicode() == 's')
1170 1171 1172 1173 1174 1175 1176 1177 1178
                return T_DOXY_RELATES;
            }
          }
        }
      }
      else if (s[2].unicode() == 'm') {
        if (s[3].unicode() == 'a') {
          if (s[4].unicode() == 'r') {
            if (s[5].unicode() == 'k') {
1179
              if (s[6].unicode() == 's')
1180 1181 1182 1183 1184 1185 1186 1187 1188
                return T_DOXY_REMARKS;
            }
          }
        }
      }
      else if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'u') {
          if (s[4].unicode() == 'r') {
            if (s[5].unicode() == 'n') {
1189
              if (s[6].unicode() == 's')
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
                return T_DOXY_RETURNS;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 's') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'c') {
        if (s[3].unicode() == 't') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'o') {
1203
              if (s[6].unicode() == 'n')
1204 1205 1206 1207 1208
                return T_DOXY_SECTION;
            }
          }
        }
      }
Roberto Raggi's avatar
Roberto Raggi committed
1209 1210 1211 1212
      else if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'v') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'c') {
1213
              if (s[6].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
                return T_DOXY_SERVICE;
            }
          }
        }
      }
    }
    else if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 'd') {
        if (s[3].unicode() == 'e') {
          if (s[4].unicode() == 'b') {
            if (s[5].unicode() == 'a') {
1225
              if (s[6].unicode() == 'r')
Roberto Raggi's avatar
Roberto Raggi committed
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
                return T_DOXY_SIDEBAR;
            }
          }
        }
      }
    }
    else if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'p') {
          if (s[4].unicode() == 'p') {
            if (s[5].unicode() == 'e') {
1237
              if (s[6].unicode() == 't')
Roberto Raggi's avatar
Roberto Raggi committed
1238 1239 1240 1241 1242
                return T_DOXY_SNIPPET;
            }
          }
        }
      }
1243 1244 1245 1246 1247 1248 1249 1250
    }
  }
  else if (s[0].unicode() == 't') {
    if (s[1].unicode() == 'y') {
      if (s[2].unicode() == 'p') {
        if (s[3].unicode() == 'e') {
          if (s[4].unicode() == 'd') {
            if (s[5].unicode() == 'e') {
1251
              if (s[6].unicode() == 'f')
1252 1253 1254 1255 1256 1257 1258
                return T_DOXY_TYPEDEF;
            }
          }
        }
      }
    }
  }
Roberto Raggi's avatar
Roberto Raggi committed
1259 1260 1261 1262 1263 1264
  else if (s[0].unicode() == 'u') {
    if (s[1].unicode() == 'i') {
      if (s[2].unicode() == 't') {
        if (s[3].unicode() == 'o') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'l') {
1265
              if (s[6].unicode() == 's')
Roberto Raggi's avatar
Roberto Raggi committed
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276
                return T_DOXY_UITOOLS;
            }
          }
        }
      }
    }
    else if (s[1].unicode() == 'n') {
      if (s[2].unicode() == 'i') {
        if (s[3].unicode() == 'c') {
          if (s[4].unicode() == 'o') {
            if (s[5].unicode() == 'd') {
1277
              if (s[6].unicode() == 'e')
Roberto Raggi's avatar
Roberto Raggi committed
1278 1279 1280 1281 1282 1283 1284
                return T_DOXY_UNICODE;
            }
          }
        }
      }
    }
  }
1285 1286 1287 1288 1289 1290
  else if (s[0].unicode() == 'v') {
    if (s[1].unicode() == 'e') {
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 's') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'o') {
1291
              if (s[6].unicode() == 'n')
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304
                return T_DOXY_VERSION;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'w') {
    if (s[1].unicode() == 'a') {
      if (s[2].unicode() == 'r') {
        if (s[3].unicode() == 'n') {
          if (s[4].unicode() == 'i') {
            if (s[5].unicode() == 'n') {
1305
              if (s[6].unicode() == 'g')
1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318
                return T_DOXY_WARNING;
            }
          }
        }
      }
    }
  }
  else if (s[0].unicode() == 'x') {
    if (s[1].unicode() == 'm') {
      if (s[2].unicode() == 'l') {
        if (s[3].unicode() == 'o') {
          if (s[4].unicode() == 'n') {
            if (s[5].unicode() == 'l') {
1319
              if (s[6].unicode() == 'y')
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
                return T_DOXY_XMLONLY;
            }
          }
        }
      }
    }
  }
  return T_DOXY_IDENTIFIER;
}

static inline int classify8(const QChar *s) {
  if (s[0].unicode() == 'a') {
Roberto Raggi's avatar
Roberto Raggi committed
1332 1333 1334 1335 1336 1337
    if (s[1].unicode() == 'b') {
      if (s[2].unicode() == 's') {
        if (s[3].unicode() == 't') {
          if (s[4].unicode() == 'r') {
            if (s[5].unicode() == 'a') {
              if (s[6].unicode() == 'c') {