forked from qt-creator/qt-creator
C++: Reformat token_names table
Token::spell() uses CPlusPlus::Kind as index into token_names. However, checking whether CPlusPlus::Kind matches token_names is easier if it's formatted in a similar way. Change-Id: I3f32b72cf9508c2ea3a4fe6911c3853c309d9e9f Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
242
src/libs/3rdparty/cplusplus/Token.cpp
vendored
242
src/libs/3rdparty/cplusplus/Token.cpp
vendored
@@ -24,64 +24,220 @@
|
||||
using namespace CPlusPlus;
|
||||
|
||||
const char *token_names[] = {
|
||||
(""), ("<error>"),
|
||||
(""),
|
||||
("<error>"),
|
||||
|
||||
("<C++ comment>"), ("<C++ doxy comment>"),
|
||||
("<comment>"), ("<doxy comment>"),
|
||||
// comments
|
||||
("<C++ comment>"),
|
||||
("<C++ doxy comment>"),
|
||||
("<comment>"),
|
||||
("<doxy comment>"),
|
||||
|
||||
("<identifier>"),
|
||||
|
||||
// literals
|
||||
("<numeric literal>"),
|
||||
("<char literal>"), ("<wide char literal>"), ("<utf16 char literal>"), ("<utf32 char literal>"),
|
||||
("<string literal>"), ("<wide string literal>"), ("<utf8 string literal>"),
|
||||
("<utf16 string literal>"), ("<utf32 string literal>"),
|
||||
("<raw string literal>"), ("<raw wide string literal>"), ("<raw utf8 string literal>"),
|
||||
("<raw utf16 string literal>"), ("<raw utf32 string literal>"),
|
||||
("<@string literal>"), ("<angle string literal>"),
|
||||
("<char literal>"),
|
||||
("<wide char literal>"),
|
||||
("<utf16 char literal>"),
|
||||
("<utf32 char literal>"),
|
||||
("<string literal>"),
|
||||
("<wide string literal>"),
|
||||
("<utf8 string literal>"),
|
||||
("<utf16 string literal>"),
|
||||
("<utf32 string literal>"),
|
||||
("<raw string literal>"),
|
||||
("<raw wide string literal>"),
|
||||
("<raw utf8 string literal>"),
|
||||
("<raw utf16 string literal>"),
|
||||
("<raw utf32 string literal>"),
|
||||
("<@string literal>"),
|
||||
("<angle string literal>"),
|
||||
|
||||
("&"), ("&&"), ("&="), ("->"), ("->*"), ("^"), ("^="), (":"), ("::"),
|
||||
(","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), ("!"),
|
||||
("!="), (">"), (">="), (">>"), (">>="), ("{"), ("["), ("<"), ("<="),
|
||||
("<<"), ("<<="), ("("), ("-"), ("-="), ("--"), ("%"), ("%="), ("|"),
|
||||
("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"),
|
||||
("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="),
|
||||
// operators
|
||||
("&"),
|
||||
("&&"),
|
||||
("&="),
|
||||
("->"),
|
||||
("->*"),
|
||||
("^"),
|
||||
("^="),
|
||||
(":"),
|
||||
("::"),
|
||||
(","),
|
||||
("/"),
|
||||
("/="),
|
||||
("."),
|
||||
("..."),
|
||||
(".*"),
|
||||
("="),
|
||||
("=="),
|
||||
("!"),
|
||||
("!="),
|
||||
(">"),
|
||||
(">="),
|
||||
(">>"),
|
||||
(">>="),
|
||||
("{"),
|
||||
("["),
|
||||
("<"),
|
||||
("<="),
|
||||
("<<"),
|
||||
("<<="),
|
||||
("("),
|
||||
("-"),
|
||||
("-="),
|
||||
("--"),
|
||||
("%"),
|
||||
("%="),
|
||||
("|"),
|
||||
("|="),
|
||||
("||"),
|
||||
("+"),
|
||||
("+="),
|
||||
("++"),
|
||||
("#"),
|
||||
("##"),
|
||||
("?"),
|
||||
("}"),
|
||||
("]"),
|
||||
(")"),
|
||||
(";"),
|
||||
("*"),
|
||||
("*="),
|
||||
("~"),
|
||||
("~="),
|
||||
|
||||
("alignas"), ("alignof"), ("asm"), ("auto"), ("break"), ("case"), ("catch"),
|
||||
("class"), ("const"), ("const_cast"), ("constexpr"), ("continue"),
|
||||
("decltype"), ("default"),
|
||||
("delete"), ("do"), ("dynamic_cast"), ("else"), ("enum"),
|
||||
("explicit"), ("export"), ("extern"), ("false"), ("for"),
|
||||
("friend"), ("goto"), ("if"), ("inline"),
|
||||
("mutable"), ("namespace"), ("new"), ("noexcept"),
|
||||
("nullptr"), ("operator"), ("private"),
|
||||
("protected"), ("public"), ("register"), ("reinterpret_cast"),
|
||||
("return"), ("sizeof"), ("static"), ("static_assert"),
|
||||
("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("thread_local"),
|
||||
("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"),
|
||||
("union"), ("using"), ("virtual"),
|
||||
("volatile"), ("while"),
|
||||
// keywords
|
||||
("alignas"),
|
||||
("alignof"),
|
||||
("asm"),
|
||||
("auto"),
|
||||
("break"),
|
||||
("case"),
|
||||
("catch"),
|
||||
("class"),
|
||||
("const"),
|
||||
("const_cast"),
|
||||
("constexpr"),
|
||||
("continue"),
|
||||
("decltype"),
|
||||
("default"),
|
||||
("delete"),
|
||||
("do"),
|
||||
("dynamic_cast"),
|
||||
("else"),
|
||||
("enum"),
|
||||
("explicit"),
|
||||
("export"),
|
||||
("extern"),
|
||||
("false"),
|
||||
("for"),
|
||||
("friend"),
|
||||
("goto"),
|
||||
("if"),
|
||||
("inline"),
|
||||
("mutable"),
|
||||
("namespace"),
|
||||
("new"),
|
||||
("noexcept"),
|
||||
("nullptr"),
|
||||
("operator"),
|
||||
("private"),
|
||||
("protected"),
|
||||
("public"),
|
||||
("register"),
|
||||
("reinterpret_cast"),
|
||||
("return"),
|
||||
("sizeof"),
|
||||
("static"),
|
||||
("static_assert"),
|
||||
("static_cast"),
|
||||
("struct"),
|
||||
("switch"),
|
||||
("template"),
|
||||
("this"),
|
||||
("thread_local"),
|
||||
("throw"),
|
||||
("true"),
|
||||
("try"),
|
||||
("typedef"),
|
||||
("typeid"),
|
||||
("typename"),
|
||||
("union"),
|
||||
("using"),
|
||||
("virtual"),
|
||||
("volatile"),
|
||||
("while"),
|
||||
|
||||
// gnu
|
||||
("__attribute__"), ("__thread"), ("__typeof__"),
|
||||
("__attribute__"),
|
||||
("__thread"),
|
||||
("__typeof__"),
|
||||
|
||||
// objc @keywords
|
||||
("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"),
|
||||
("@encode"), ("@end"), ("@finally"), ("@implementation"), ("@interface"),
|
||||
("@not_keyword"), ("@optional"), ("@package"), ("@private"), ("@property"),
|
||||
("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"),
|
||||
("@synchronized"), ("@synthesize"), ("@throw"), ("@try"),
|
||||
("@catch"),
|
||||
("@class"),
|
||||
("@compatibility_alias"),
|
||||
("@defs"),
|
||||
("@dynamic"),
|
||||
("@encode"),
|
||||
("@end"),
|
||||
("@finally"),
|
||||
("@implementation"),
|
||||
("@interface"),
|
||||
("@not_keyword"),
|
||||
("@optional"),
|
||||
("@package"),
|
||||
("@private"),
|
||||
("@property"),
|
||||
("@protected"),
|
||||
("@protocol"),
|
||||
("@public"),
|
||||
("@required"),
|
||||
("@selector"),
|
||||
("@synchronized"),
|
||||
("@synthesize"),
|
||||
("@throw"),
|
||||
("@try"),
|
||||
|
||||
// Primitive types
|
||||
("bool"), ("char"), ("char16_t"), ("char32_t"), ("double"), ("float"), ("int"),
|
||||
("long"), ("short"), ("signed"), ("unsigned"), ("void"), ("wchar_t"),
|
||||
("bool"),
|
||||
("char"),
|
||||
("char16_t"),
|
||||
("char32_t"),
|
||||
("double"),
|
||||
("float"),
|
||||
("int"),
|
||||
("long"),
|
||||
("short"),
|
||||
("signed"),
|
||||
("unsigned"),
|
||||
("void"),
|
||||
("wchar_t"),
|
||||
|
||||
// Qt keywords
|
||||
("emit"), ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"),
|
||||
("Q_FOREACH"), ("Q_D"), ("Q_Q"),
|
||||
("Q_INVOKABLE"), ("Q_PROPERTY"), ("T_Q_PRIVATE_PROPERTY"),
|
||||
("Q_INTERFACES"), ("Q_EMIT"), ("Q_ENUMS"), ("Q_FLAGS"),
|
||||
("Q_PRIVATE_SLOT"), ("Q_DECLARE_INTERFACE"), ("Q_OBJECT"), ("Q_GADGET"),
|
||||
|
||||
("emit"),
|
||||
("SIGNAL"),
|
||||
("SLOT"),
|
||||
("Q_SIGNAL"),
|
||||
("Q_SLOT"),
|
||||
("signals"),
|
||||
("slots"),
|
||||
("Q_FOREACH"),
|
||||
("Q_D"),
|
||||
("Q_Q"),
|
||||
("Q_INVOKABLE"),
|
||||
("Q_PROPERTY"),
|
||||
("T_Q_PRIVATE_PROPERTY"),
|
||||
("Q_INTERFACES"),
|
||||
("Q_EMIT"),
|
||||
("Q_ENUMS"),
|
||||
("Q_FLAGS"),
|
||||
("Q_PRIVATE_SLOT"),
|
||||
("Q_DECLARE_INTERFACE"),
|
||||
("Q_OBJECT"),
|
||||
("Q_GADGET"),
|
||||
};
|
||||
|
||||
void Token::reset()
|
||||
|
Reference in New Issue
Block a user