aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-11-01 14:10:38 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2018-11-02 08:46:21 +0000
commita80396f807f8b270a20f4a4ad6f315770ccd54c6 (patch)
tree612394dec02bb73ef3770314b59871415b1afb48 /src/libs/3rdparty
parent38d39fb9f04ea31fa6e76ce70a9dc65d4e58d166 (diff)
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>
Diffstat (limited to 'src/libs/3rdparty')
-rw-r--r--src/libs/3rdparty/cplusplus/Token.cpp246
1 files changed, 201 insertions, 45 deletions
diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp
index 2f6ce3d608..4017855c7f 100644
--- a/src/libs/3rdparty/cplusplus/Token.cpp
+++ b/src/libs/3rdparty/cplusplus/Token.cpp
@@ -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>"),
-
- ("&"), ("&&"), ("&="), ("->"), ("->*"), ("^"), ("^="), (":"), ("::"),
- (","), ("/"), ("/="), ("."), ("..."), (".*"), ("="), ("=="), ("!"),
- ("!="), (">"), (">="), (">>"), (">>="), ("{"), ("["), ("<"), ("<="),
- ("<<"), ("<<="), ("("), ("-"), ("-="), ("--"), ("%"), ("%="), ("|"),
- ("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"),
- ("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="),
-
- ("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"),
+ ("<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
+ ("&"),
+ ("&&"),
+ ("&="),
+ ("->"),
+ ("->*"),
+ ("^"),
+ ("^="),
+ (":"),
+ ("::"),
+ (","),
+ ("/"),
+ ("/="),
+ ("."),
+ ("..."),
+ (".*"),
+ ("="),
+ ("=="),
+ ("!"),
+ ("!="),
+ (">"),
+ (">="),
+ (">>"),
+ (">>="),
+ ("{"),
+ ("["),
+ ("<"),
+ ("<="),
+ ("<<"),
+ ("<<="),
+ ("("),
+ ("-"),
+ ("-="),
+ ("--"),
+ ("%"),
+ ("%="),
+ ("|"),
+ ("|="),
+ ("||"),
+ ("+"),
+ ("+="),
+ ("++"),
+ ("#"),
+ ("##"),
+ ("?"),
+ ("}"),
+ ("]"),
+ (")"),
+ (";"),
+ ("*"),
+ ("*="),
+ ("~"),
+ ("~="),
+
+ // 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()