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;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
const char *token_names[] = {
|
const char *token_names[] = {
|
||||||
(""), ("<error>"),
|
(""),
|
||||||
|
("<error>"),
|
||||||
|
|
||||||
("<C++ comment>"), ("<C++ doxy comment>"),
|
// comments
|
||||||
("<comment>"), ("<doxy comment>"),
|
("<C++ comment>"),
|
||||||
|
("<C++ doxy comment>"),
|
||||||
|
("<comment>"),
|
||||||
|
("<doxy comment>"),
|
||||||
|
|
||||||
("<identifier>"),
|
("<identifier>"),
|
||||||
|
|
||||||
|
// literals
|
||||||
("<numeric literal>"),
|
("<numeric literal>"),
|
||||||
("<char literal>"), ("<wide char literal>"), ("<utf16 char literal>"), ("<utf32 char literal>"),
|
("<char literal>"),
|
||||||
("<string literal>"), ("<wide string literal>"), ("<utf8 string literal>"),
|
("<wide char literal>"),
|
||||||
("<utf16 string literal>"), ("<utf32 string literal>"),
|
("<utf16 char literal>"),
|
||||||
("<raw string literal>"), ("<raw wide string literal>"), ("<raw utf8 string literal>"),
|
("<utf32 char literal>"),
|
||||||
("<raw utf16 string literal>"), ("<raw utf32 string literal>"),
|
("<string literal>"),
|
||||||
("<@string literal>"), ("<angle 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"),
|
// keywords
|
||||||
("class"), ("const"), ("const_cast"), ("constexpr"), ("continue"),
|
("alignas"),
|
||||||
("decltype"), ("default"),
|
("alignof"),
|
||||||
("delete"), ("do"), ("dynamic_cast"), ("else"), ("enum"),
|
("asm"),
|
||||||
("explicit"), ("export"), ("extern"), ("false"), ("for"),
|
("auto"),
|
||||||
("friend"), ("goto"), ("if"), ("inline"),
|
("break"),
|
||||||
("mutable"), ("namespace"), ("new"), ("noexcept"),
|
("case"),
|
||||||
("nullptr"), ("operator"), ("private"),
|
("catch"),
|
||||||
("protected"), ("public"), ("register"), ("reinterpret_cast"),
|
("class"),
|
||||||
("return"), ("sizeof"), ("static"), ("static_assert"),
|
("const"),
|
||||||
("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("thread_local"),
|
("const_cast"),
|
||||||
("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"),
|
("constexpr"),
|
||||||
("union"), ("using"), ("virtual"),
|
("continue"),
|
||||||
("volatile"), ("while"),
|
("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
|
// gnu
|
||||||
("__attribute__"), ("__thread"), ("__typeof__"),
|
("__attribute__"),
|
||||||
|
("__thread"),
|
||||||
|
("__typeof__"),
|
||||||
|
|
||||||
// objc @keywords
|
// objc @keywords
|
||||||
("@catch"), ("@class"), ("@compatibility_alias"), ("@defs"), ("@dynamic"),
|
("@catch"),
|
||||||
("@encode"), ("@end"), ("@finally"), ("@implementation"), ("@interface"),
|
("@class"),
|
||||||
("@not_keyword"), ("@optional"), ("@package"), ("@private"), ("@property"),
|
("@compatibility_alias"),
|
||||||
("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"),
|
("@defs"),
|
||||||
("@synchronized"), ("@synthesize"), ("@throw"), ("@try"),
|
("@dynamic"),
|
||||||
|
("@encode"),
|
||||||
|
("@end"),
|
||||||
|
("@finally"),
|
||||||
|
("@implementation"),
|
||||||
|
("@interface"),
|
||||||
|
("@not_keyword"),
|
||||||
|
("@optional"),
|
||||||
|
("@package"),
|
||||||
|
("@private"),
|
||||||
|
("@property"),
|
||||||
|
("@protected"),
|
||||||
|
("@protocol"),
|
||||||
|
("@public"),
|
||||||
|
("@required"),
|
||||||
|
("@selector"),
|
||||||
|
("@synchronized"),
|
||||||
|
("@synthesize"),
|
||||||
|
("@throw"),
|
||||||
|
("@try"),
|
||||||
|
|
||||||
// Primitive types
|
// Primitive types
|
||||||
("bool"), ("char"), ("char16_t"), ("char32_t"), ("double"), ("float"), ("int"),
|
("bool"),
|
||||||
("long"), ("short"), ("signed"), ("unsigned"), ("void"), ("wchar_t"),
|
("char"),
|
||||||
|
("char16_t"),
|
||||||
|
("char32_t"),
|
||||||
|
("double"),
|
||||||
|
("float"),
|
||||||
|
("int"),
|
||||||
|
("long"),
|
||||||
|
("short"),
|
||||||
|
("signed"),
|
||||||
|
("unsigned"),
|
||||||
|
("void"),
|
||||||
|
("wchar_t"),
|
||||||
|
|
||||||
// Qt keywords
|
// Qt keywords
|
||||||
("emit"), ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"),
|
("emit"),
|
||||||
("Q_FOREACH"), ("Q_D"), ("Q_Q"),
|
("SIGNAL"),
|
||||||
("Q_INVOKABLE"), ("Q_PROPERTY"), ("T_Q_PRIVATE_PROPERTY"),
|
("SLOT"),
|
||||||
("Q_INTERFACES"), ("Q_EMIT"), ("Q_ENUMS"), ("Q_FLAGS"),
|
("Q_SIGNAL"),
|
||||||
("Q_PRIVATE_SLOT"), ("Q_DECLARE_INTERFACE"), ("Q_OBJECT"), ("Q_GADGET"),
|
("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()
|
void Token::reset()
|
||||||
|
Reference in New Issue
Block a user