Advertisement
Guest User

QtCreator POD highlighting patch

a guest
Nov 16th, 2011
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 7.35 KB | None | 0 0
  1. diff -Naurb ./src/qt-creator-2.3.1-src/src/libs/3rdparty/cplusplus/Token.h ./src_patched/qt-creator-2.3.1-src/src/libs/3rdparty/cplusplus/Token.h
  2. --- ./src/qt-creator-2.3.1-src/src/libs/3rdparty/cplusplus/Token.h  2011-09-21 10:31:14.000000000 +0400
  3. +++ ./src_patched/qt-creator-2.3.1-src/src/libs/3rdparty/cplusplus/Token.h  2011-11-16 20:25:28.400382335 +0400
  4. @@ -103,11 +103,9 @@
  5.      T_FIRST_KEYWORD,
  6.      T_ASM = T_FIRST_KEYWORD,
  7.      T_AUTO,
  8. -    T_BOOL,
  9.      T_BREAK,
  10.      T_CASE,
  11.      T_CATCH,
  12. -    T_CHAR,
  13.      T_CLASS,
  14.      T_CONST,
  15.      T_CONST_CAST,
  16. @@ -115,7 +113,6 @@
  17.      T_DEFAULT,
  18.      T_DELETE,
  19.      T_DO,
  20. -    T_DOUBLE,
  21.      T_DYNAMIC_CAST,
  22.      T_ELSE,
  23.      T_ENUM,
  24. @@ -123,14 +120,11 @@
  25.      T_EXPORT,
  26.      T_EXTERN,
  27.      T_FALSE,
  28. -    T_FLOAT,
  29.      T_FOR,
  30.      T_FRIEND,
  31.      T_GOTO,
  32.      T_IF,
  33.      T_INLINE,
  34. -    T_INT,
  35. -    T_LONG,
  36.      T_MUTABLE,
  37.      T_NAMESPACE,
  38.      T_NEW,
  39. @@ -141,8 +135,6 @@
  40.      T_REGISTER,
  41.      T_REINTERPRET_CAST,
  42.      T_RETURN,
  43. -    T_SHORT,
  44. -    T_SIGNED,
  45.      T_SIZEOF,
  46.      T_STATIC,
  47.      T_STATIC_CAST,
  48. @@ -157,12 +149,9 @@
  49.      T_TYPEID,
  50.      T_TYPENAME,
  51.      T_UNION,
  52. -    T_UNSIGNED,
  53.      T_USING,
  54.      T_VIRTUAL,
  55. -    T_VOID,
  56.      T_VOLATILE,
  57. -    T_WCHAR_T,
  58.      T_WHILE,
  59.  
  60.      T___ATTRIBUTE__,
  61. @@ -222,6 +211,20 @@
  62.      T_Q_GADGET,
  63.      T_LAST_KEYWORD = T_Q_GADGET,
  64.  
  65. +   T_FIRST_POD,
  66. +   T_BOOL = T_FIRST_POD,
  67. +   T_CHAR,
  68. +   T_DOUBLE,
  69. +   T_FLOAT,
  70. +   T_INT,
  71. +   T_LONG,
  72. +   T_SHORT,
  73. +   T_SIGNED,
  74. +   T_UNSIGNED,
  75. +   T_VOID,
  76. +   T_WCHAR_T,
  77. +   T_LAST_POD = T_WCHAR_T,
  78. +
  79.      // aliases
  80.      T_OR = T_PIPE_PIPE,
  81.      T_AND = T_AMPER_AMPER,
  82. @@ -287,6 +290,9 @@
  83.      inline bool isKeyword() const
  84.      { return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_QT_KEYWORD; }
  85.  
  86. +   inline bool isPodType() const
  87. +   { return f.kind >= T_FIRST_POD && f.kind <= T_LAST_POD; }
  88. +
  89.      inline bool isComment() const
  90.      { return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT ||
  91.        f.kind == T_CPP_COMMENT || f.kind == T_CPP_DOXY_COMMENT; }
  92. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.cpp ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.cpp
  93. --- ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.cpp  2011-09-21 10:31:14.000000000 +0400
  94. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.cpp  2011-11-16 21:37:11.576917776 +0400
  95. @@ -2232,6 +2232,7 @@
  96.      if (categories.isEmpty()) {
  97.          categories << QLatin1String(TextEditor::Constants::C_NUMBER)
  98.                     << QLatin1String(TextEditor::Constants::C_STRING)
  99. +                  << QLatin1String(TextEditor::Constants::C_POD_TYPE)
  100.                     << QLatin1String(TextEditor::Constants::C_TYPE)
  101.                     << QLatin1String(TextEditor::Constants::C_KEYWORD)
  102.                     << QLatin1String(TextEditor::Constants::C_OPERATOR)
  103. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditorenums.h ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditorenums.h
  104. --- ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditorenums.h   2011-09-21 10:31:14.000000000 +0400
  105. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditorenums.h   2011-11-16 20:25:28.393715669 +0400
  106. @@ -44,6 +44,7 @@
  107.  enum CppFormats {
  108.      CppNumberFormat,
  109.      CppStringFormat,
  110. +   CppPodTypeFormat,
  111.      CppTypeFormat,
  112.      CppKeywordFormat,
  113.      CppOperatorFormat,
  114. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.h ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.h
  115. --- ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.h    2011-09-21 10:31:14.000000000 +0400
  116. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cppeditor.h    2011-11-16 21:37:11.513584445 +0400
  117. @@ -286,6 +286,7 @@
  118.      QTextCharFormat m_occurrencesFormat;
  119.      QTextCharFormat m_occurrencesUnusedFormat;
  120.      QTextCharFormat m_occurrenceRenameFormat;
  121. +   QTextCharFormat m_podTypeFormat;
  122.      QTextCharFormat m_typeFormat;
  123.      QTextCharFormat m_localFormat;
  124.      QTextCharFormat m_fieldFormat;
  125. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cpphighlighter.cpp ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cpphighlighter.cpp
  126. --- ./src/qt-creator-2.3.1-src/src/plugins/cppeditor/cpphighlighter.cpp 2011-09-21 10:31:14.000000000 +0400
  127. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/cppeditor/cpphighlighter.cpp 2011-11-16 22:25:15.196829839 +0400
  128. @@ -195,6 +195,9 @@
  129.          } else if (tk.isKeyword() || isQtKeyword(text.midRef(tk.begin(), tk.length())) || tk.isObjCAtKeyword())
  130.              setFormat(tk.begin(), tk.length(), m_formats[CppKeywordFormat]);
  131.  
  132. +       else if (tk.isPodType())
  133. +           setFormat(tk.begin(), tk.length(), m_formats[CppPodTypeFormat]);
  134. +
  135.          else if (tk.isOperator())
  136.              setFormat(tk.begin(), tk.length(), m_formats[CppOperatorFormat]);
  137.  
  138. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorconstants.h ./src_patched/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorconstants.h
  139. --- ./src/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorconstants.h 2011-09-21 10:31:14.000000000 +0400
  140. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorconstants.h 2011-11-16 21:37:11.580251109 +0400
  141. @@ -115,6 +115,7 @@
  142.  
  143.  const char * const C_NUMBER              = "Number";
  144.  const char * const C_STRING              = "String";
  145. +const char * const C_POD_TYPE            = "POD";
  146.  const char * const C_TYPE                = "Type";
  147.  const char * const C_LOCAL               = "Local";
  148.  const char * const C_FIELD               = "Field";
  149. diff -Naurb ./src/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorsettings.cpp ./src_patched/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorsettings.cpp
  150. --- ./src/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorsettings.cpp    2011-09-21 10:31:14.000000000 +0400
  151. +++ ./src_patched/qt-creator-2.3.1-src/src/plugins/texteditor/texteditorsettings.cpp    2011-11-16 22:24:37.580164320 +0400
  152. @@ -135,6 +135,7 @@
  153.      // Standard categories
  154.      formatDescriptions.append(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue));
  155.      formatDescriptions.append(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen));
  156. +   formatDescriptions.append(FormatDescription(QLatin1String(C_POD_TYPE), tr("POD Type"), Qt::darkYellow));
  157.      formatDescriptions.append(FormatDescription(QLatin1String(C_TYPE), tr("Type"), Qt::darkMagenta));
  158.      formatDescriptions.append(FormatDescription(QLatin1String(C_LOCAL), tr("Local")));
  159.      formatDescriptions.append(FormatDescription(QLatin1String(C_FIELD), tr("Field"), Qt::darkRed));
  160. @@ -144,7 +145,10 @@
  161.      virtualMethodFormatDescriptor.format().setItalic(true);
  162.      formatDescriptions.append(virtualMethodFormatDescriptor);
  163.  
  164. -    formatDescriptions.append(FormatDescription(QLatin1String(C_KEYWORD), tr("Keyword"), Qt::darkYellow));
  165. +   FormatDescription keywordFormatDescriptor(QLatin1String(C_KEYWORD), tr("Keyword"), Qt::black);
  166. +   keywordFormatDescriptor.format().setBold(true);
  167. +   formatDescriptions.append(keywordFormatDescriptor);
  168. +
  169.      formatDescriptions.append(FormatDescription(QLatin1String(C_OPERATOR), tr("Operator")));
  170.      formatDescriptions.append(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue));
  171.      formatDescriptions.append(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed));
  172.  
  173.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement