forked from qt-creator/qt-creator
Add syntax highlight for primitive data types
Syntax highlight rules for keywords are changed to highlight control keywords and primitive data types separately. Change-Id: Ifb25be7a97b92589030aa190641320c233dc7f2d Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
2982a763ac
commit
496cfdd21d
19
src/libs/3rdparty/cplusplus/Token.cpp
vendored
19
src/libs/3rdparty/cplusplus/Token.cpp
vendored
@@ -46,21 +46,20 @@ const char *token_names[] = {
|
||||
("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"),
|
||||
("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="),
|
||||
|
||||
("alignas"), ("alignof"), ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"),
|
||||
("char"), ("char16_t"), ("char32_t"),
|
||||
("alignas"), ("alignof"), ("asm"), ("auto"), ("break"), ("case"), ("catch"),
|
||||
("class"), ("const"), ("const_cast"), ("constexpr"), ("continue"),
|
||||
("decltype"), ("default"),
|
||||
("delete"), ("do"), ("double"), ("dynamic_cast"), ("else"), ("enum"),
|
||||
("explicit"), ("export"), ("extern"), ("false"), ("float"), ("for"),
|
||||
("friend"), ("goto"), ("if"), ("inline"), ("int"), ("long"),
|
||||
("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"), ("short"), ("signed"), ("sizeof"), ("static"),("static_assert"),
|
||||
("return"), ("sizeof"), ("static"), ("static_assert"),
|
||||
("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("thread_local"),
|
||||
("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"),
|
||||
("union"), ("unsigned"), ("using"), ("virtual"), ("void"),
|
||||
("volatile"), ("wchar_t"), ("while"),
|
||||
("union"), ("using"), ("virtual"),
|
||||
("volatile"), ("while"),
|
||||
|
||||
// gnu
|
||||
("__attribute__"), ("__thread"), ("__typeof__"),
|
||||
@@ -72,6 +71,10 @@ const char *token_names[] = {
|
||||
("@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"),
|
||||
|
||||
// Qt keywords
|
||||
("emit"), ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"),
|
||||
("Q_FOREACH"), ("Q_D"), ("Q_Q"),
|
||||
|
||||
36
src/libs/3rdparty/cplusplus/Token.h
vendored
36
src/libs/3rdparty/cplusplus/Token.h
vendored
@@ -119,13 +119,9 @@ enum Kind {
|
||||
T_ALIGNOF,
|
||||
T_ASM,
|
||||
T_AUTO,
|
||||
T_BOOL,
|
||||
T_BREAK,
|
||||
T_CASE,
|
||||
T_CATCH,
|
||||
T_CHAR,
|
||||
T_CHAR16_T,
|
||||
T_CHAR32_T,
|
||||
T_CLASS,
|
||||
T_CONST,
|
||||
T_CONST_CAST,
|
||||
@@ -135,7 +131,6 @@ enum Kind {
|
||||
T_DEFAULT,
|
||||
T_DELETE,
|
||||
T_DO,
|
||||
T_DOUBLE,
|
||||
T_DYNAMIC_CAST,
|
||||
T_ELSE,
|
||||
T_ENUM,
|
||||
@@ -143,14 +138,11 @@ enum Kind {
|
||||
T_EXPORT,
|
||||
T_EXTERN,
|
||||
T_FALSE,
|
||||
T_FLOAT,
|
||||
T_FOR,
|
||||
T_FRIEND,
|
||||
T_GOTO,
|
||||
T_IF,
|
||||
T_INLINE,
|
||||
T_INT,
|
||||
T_LONG,
|
||||
T_MUTABLE,
|
||||
T_NAMESPACE,
|
||||
T_NEW,
|
||||
@@ -163,8 +155,6 @@ enum Kind {
|
||||
T_REGISTER,
|
||||
T_REINTERPRET_CAST,
|
||||
T_RETURN,
|
||||
T_SHORT,
|
||||
T_SIGNED,
|
||||
T_SIZEOF,
|
||||
T_STATIC,
|
||||
T_STATIC_ASSERT,
|
||||
@@ -181,12 +171,9 @@ enum Kind {
|
||||
T_TYPEID,
|
||||
T_TYPENAME,
|
||||
T_UNION,
|
||||
T_UNSIGNED,
|
||||
T_USING,
|
||||
T_VIRTUAL,
|
||||
T_VOID,
|
||||
T_VOLATILE,
|
||||
T_WCHAR_T,
|
||||
T_WHILE,
|
||||
|
||||
T___ATTRIBUTE__,
|
||||
@@ -223,6 +210,23 @@ enum Kind {
|
||||
|
||||
T_LAST_OBJC_AT_KEYWORD = T_AT_TRY,
|
||||
|
||||
// Primitive types
|
||||
T_FIRST_PRIMITIVE,
|
||||
T_BOOL = T_FIRST_PRIMITIVE,
|
||||
T_CHAR,
|
||||
T_CHAR16_T,
|
||||
T_CHAR32_T,
|
||||
T_DOUBLE,
|
||||
T_FLOAT,
|
||||
T_INT,
|
||||
T_LONG,
|
||||
T_SHORT,
|
||||
T_SIGNED,
|
||||
T_UNSIGNED,
|
||||
T_VOID,
|
||||
T_WCHAR_T,
|
||||
T_LAST_PRIMITIVE = T_WCHAR_T,
|
||||
|
||||
T_FIRST_QT_KEYWORD,
|
||||
|
||||
// Qt keywords
|
||||
@@ -247,6 +251,7 @@ enum Kind {
|
||||
T_Q_DECLARE_INTERFACE,
|
||||
T_Q_OBJECT,
|
||||
T_Q_GADGET,
|
||||
|
||||
T_LAST_KEYWORD = T_Q_GADGET,
|
||||
|
||||
// aliases
|
||||
@@ -320,7 +325,10 @@ public:
|
||||
{ return f.kind >= T_FIRST_OPERATOR && f.kind <= T_LAST_OPERATOR; }
|
||||
|
||||
inline bool isKeyword() const
|
||||
{ return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_QT_KEYWORD; }
|
||||
{ return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_PRIMITIVE; }
|
||||
|
||||
inline bool isPrimitiveType() const
|
||||
{ return f.kind >= T_FIRST_PRIMITIVE && f.kind <= T_LAST_PRIMITIVE; }
|
||||
|
||||
inline bool isComment() const
|
||||
{ return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT ||
|
||||
|
||||
Reference in New Issue
Block a user