qscilexercpp.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. // This module implements the QsciLexerCPP class.
  2. //
  3. // Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com>
  4. //
  5. // This file is part of QScintilla.
  6. //
  7. // This file may be used under the terms of the GNU General Public License
  8. // version 3.0 as published by the Free Software Foundation and appearing in
  9. // the file LICENSE included in the packaging of this file. Please review the
  10. // following information to ensure the GNU General Public License version 3.0
  11. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  12. //
  13. // If you do not wish to use this file under the terms of the GPL version 3.0
  14. // then you may purchase a commercial license. For more information contact
  15. // info@riverbankcomputing.com.
  16. //
  17. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  18. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #include "Qsci/qscilexercpp.h"
  20. #include <qcolor.h>
  21. #include <qfont.h>
  22. #include <qsettings.h>
  23. // The ctor.
  24. QsciLexerCPP::QsciLexerCPP(QObject *parent, bool caseInsensitiveKeywords)
  25. : QsciLexer(parent),
  26. fold_atelse(false), fold_comments(false), fold_compact(true),
  27. fold_preproc(true), style_preproc(false), dollars(true),
  28. highlight_triple(false), highlight_hash(false), highlight_back(false),
  29. highlight_escape(false), vs_escape(false),
  30. nocase(caseInsensitiveKeywords)
  31. {
  32. }
  33. // The dtor.
  34. QsciLexerCPP::~QsciLexerCPP()
  35. {
  36. }
  37. // Returns the language name.
  38. const char *QsciLexerCPP::language() const
  39. {
  40. return "C++";
  41. }
  42. // Returns the lexer name.
  43. const char *QsciLexerCPP::lexer() const
  44. {
  45. return (nocase ? "cppnocase" : "cpp");
  46. }
  47. // Return the set of character sequences that can separate auto-completion
  48. // words.
  49. QStringList QsciLexerCPP::autoCompletionWordSeparators() const
  50. {
  51. QStringList wl;
  52. wl << "::" << "->" << ".";
  53. return wl;
  54. }
  55. // Return the list of keywords that can start a block.
  56. const char *QsciLexerCPP::blockStartKeyword(int *style) const
  57. {
  58. if (style)
  59. *style = Keyword;
  60. return "case catch class default do else finally for if private "
  61. "protected public struct try union while";
  62. }
  63. // Return the list of characters that can start a block.
  64. const char *QsciLexerCPP::blockStart(int *style) const
  65. {
  66. if (style)
  67. *style = Operator;
  68. return "{";
  69. }
  70. // Return the list of characters that can end a block.
  71. const char *QsciLexerCPP::blockEnd(int *style) const
  72. {
  73. if (style)
  74. *style = Operator;
  75. return "}";
  76. }
  77. // Return the style used for braces.
  78. int QsciLexerCPP::braceStyle() const
  79. {
  80. return Operator;
  81. }
  82. // Return the string of characters that comprise a word.
  83. const char *QsciLexerCPP::wordCharacters() const
  84. {
  85. return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#";
  86. }
  87. // Returns the foreground colour of the text for a style.
  88. QColor QsciLexerCPP::defaultColor(int style) const
  89. {
  90. switch (style)
  91. {
  92. case Default:
  93. return QColor(0x80, 0x80, 0x80);
  94. case Comment:
  95. case CommentLine:
  96. return QColor(0x00, 0x7f, 0x00);
  97. case CommentDoc:
  98. case CommentLineDoc:
  99. case PreProcessorCommentLineDoc:
  100. return QColor(0x3f, 0x70, 0x3f);
  101. case Number:
  102. return QColor(0x00, 0x7f, 0x7f);
  103. case Keyword:
  104. return QColor(0x00, 0x00, 0x7f);
  105. case DoubleQuotedString:
  106. case SingleQuotedString:
  107. case RawString:
  108. return QColor(0x7f, 0x00, 0x7f);
  109. case PreProcessor:
  110. return QColor(0x7f, 0x7f, 0x00);
  111. case Operator:
  112. case UnclosedString:
  113. return QColor(0x00, 0x00, 0x00);
  114. case VerbatimString:
  115. case TripleQuotedVerbatimString:
  116. case HashQuotedString:
  117. return QColor(0x00, 0x7f, 0x00);
  118. case Regex:
  119. return QColor(0x3f, 0x7f, 0x3f);
  120. case CommentDocKeyword:
  121. return QColor(0x30, 0x60, 0xa0);
  122. case CommentDocKeywordError:
  123. return QColor(0x80, 0x40, 0x20);
  124. case PreProcessorComment:
  125. return QColor(0x65, 0x99, 0x00);
  126. case InactiveDefault:
  127. case InactiveUUID:
  128. case InactiveCommentLineDoc:
  129. case InactiveKeywordSet2:
  130. case InactiveCommentDocKeyword:
  131. case InactiveCommentDocKeywordError:
  132. case InactivePreProcessorCommentLineDoc:
  133. return QColor(0xc0, 0xc0, 0xc0);
  134. case InactiveComment:
  135. case InactiveCommentLine:
  136. case InactiveNumber:
  137. case InactiveVerbatimString:
  138. case InactiveTripleQuotedVerbatimString:
  139. case InactiveHashQuotedString:
  140. return QColor(0x90, 0xb0, 0x90);
  141. case InactiveCommentDoc:
  142. return QColor(0xd0, 0xd0, 0xd0);
  143. case InactiveKeyword:
  144. return QColor(0x90, 0x90, 0xb0);
  145. case InactiveDoubleQuotedString:
  146. case InactiveSingleQuotedString:
  147. case InactiveRawString:
  148. return QColor(0xb0, 0x90, 0xb0);
  149. case InactivePreProcessor:
  150. return QColor(0xb0, 0xb0, 0x90);
  151. case InactiveOperator:
  152. case InactiveIdentifier:
  153. case InactiveGlobalClass:
  154. return QColor(0xb0, 0xb0, 0xb0);
  155. case InactiveUnclosedString:
  156. return QColor(0x00, 0x00, 0x00);
  157. case InactiveRegex:
  158. return QColor(0x7f, 0xaf, 0x7f);
  159. case InactivePreProcessorComment:
  160. return QColor(0xa0, 0xc0, 0x90);
  161. case UserLiteral:
  162. return QColor(0xc0, 0x60, 0x00);
  163. case InactiveUserLiteral:
  164. return QColor(0xd7, 0xa0, 0x90);
  165. case TaskMarker:
  166. return QColor(0xbe, 0x07, 0xff);
  167. case InactiveTaskMarker:
  168. return QColor(0xc3, 0xa1, 0xcf);
  169. }
  170. return QsciLexer::defaultColor(style);
  171. }
  172. // Returns the end-of-line fill for a style.
  173. bool QsciLexerCPP::defaultEolFill(int style) const
  174. {
  175. switch (style)
  176. {
  177. case UnclosedString:
  178. case InactiveUnclosedString:
  179. case VerbatimString:
  180. case InactiveVerbatimString:
  181. case Regex:
  182. case InactiveRegex:
  183. case TripleQuotedVerbatimString:
  184. case InactiveTripleQuotedVerbatimString:
  185. case HashQuotedString:
  186. case InactiveHashQuotedString:
  187. return true;
  188. }
  189. return QsciLexer::defaultEolFill(style);
  190. }
  191. // Returns the font of the text for a style.
  192. QFont QsciLexerCPP::defaultFont(int style) const
  193. {
  194. QFont f;
  195. switch (style)
  196. {
  197. case Comment:
  198. case InactiveComment:
  199. case CommentLine:
  200. case InactiveCommentLine:
  201. case CommentDoc:
  202. case InactiveCommentDoc:
  203. case CommentLineDoc:
  204. case InactiveCommentLineDoc:
  205. case CommentDocKeyword:
  206. case InactiveCommentDocKeyword:
  207. case CommentDocKeywordError:
  208. case InactiveCommentDocKeywordError:
  209. case TaskMarker:
  210. case InactiveTaskMarker:
  211. #if defined(Q_OS_WIN)
  212. f = QFont("Comic Sans MS",9);
  213. #elif defined(Q_OS_MAC)
  214. f = QFont("Comic Sans MS", 12);
  215. #else
  216. f = QFont("Bitstream Vera Serif",9);
  217. #endif
  218. break;
  219. case Keyword:
  220. case InactiveKeyword:
  221. case Operator:
  222. case InactiveOperator:
  223. f = QsciLexer::defaultFont(style);
  224. f.setBold(true);
  225. break;
  226. case DoubleQuotedString:
  227. case InactiveDoubleQuotedString:
  228. case SingleQuotedString:
  229. case InactiveSingleQuotedString:
  230. case UnclosedString:
  231. case InactiveUnclosedString:
  232. case VerbatimString:
  233. case InactiveVerbatimString:
  234. case Regex:
  235. case InactiveRegex:
  236. case TripleQuotedVerbatimString:
  237. case InactiveTripleQuotedVerbatimString:
  238. case HashQuotedString:
  239. case InactiveHashQuotedString:
  240. #if defined(Q_OS_WIN)
  241. f = QFont("Courier New",10);
  242. #elif defined(Q_OS_MAC)
  243. f = QFont("Courier", 12);
  244. #else
  245. f = QFont("Bitstream Vera Sans Mono",9);
  246. #endif
  247. break;
  248. default:
  249. f = QsciLexer::defaultFont(style);
  250. }
  251. return f;
  252. }
  253. // Returns the set of keywords.
  254. const char *QsciLexerCPP::keywords(int set) const
  255. {
  256. if (set == 1)
  257. return
  258. "and and_eq asm auto bitand bitor bool break case "
  259. "catch char class compl const const_cast continue "
  260. "default delete do double dynamic_cast else enum "
  261. "explicit export extern false float for friend goto if "
  262. "inline int long mutable namespace new not not_eq "
  263. "operator or or_eq private protected public register "
  264. "reinterpret_cast return short signed sizeof static "
  265. "static_cast struct switch template this throw true "
  266. "try typedef typeid typename union unsigned using "
  267. "virtual void volatile wchar_t while xor xor_eq";
  268. if (set == 3)
  269. return
  270. "a addindex addtogroup anchor arg attention author b "
  271. "brief bug c class code date def defgroup deprecated "
  272. "dontinclude e em endcode endhtmlonly endif "
  273. "endlatexonly endlink endverbatim enum example "
  274. "exception f$ f[ f] file fn hideinitializer "
  275. "htmlinclude htmlonly if image include ingroup "
  276. "internal invariant interface latexonly li line link "
  277. "mainpage name namespace nosubgrouping note overload "
  278. "p page par param post pre ref relates remarks return "
  279. "retval sa section see showinitializer since skip "
  280. "skipline struct subsection test throw todo typedef "
  281. "union until var verbatim verbinclude version warning "
  282. "weakgroup $ @ \\ & < > # { }";
  283. return 0;
  284. }
  285. // Returns the user name of a style.
  286. QString QsciLexerCPP::description(int style) const
  287. {
  288. switch (style)
  289. {
  290. case Default:
  291. return tr("Default");
  292. case InactiveDefault:
  293. return tr("Inactive default");
  294. case Comment:
  295. return tr("C comment");
  296. case InactiveComment:
  297. return tr("Inactive C comment");
  298. case CommentLine:
  299. return tr("C++ comment");
  300. case InactiveCommentLine:
  301. return tr("Inactive C++ comment");
  302. case CommentDoc:
  303. return tr("JavaDoc style C comment");
  304. case InactiveCommentDoc:
  305. return tr("Inactive JavaDoc style C comment");
  306. case Number:
  307. return tr("Number");
  308. case InactiveNumber:
  309. return tr("Inactive number");
  310. case Keyword:
  311. return tr("Keyword");
  312. case InactiveKeyword:
  313. return tr("Inactive keyword");
  314. case DoubleQuotedString:
  315. return tr("Double-quoted string");
  316. case InactiveDoubleQuotedString:
  317. return tr("Inactive double-quoted string");
  318. case SingleQuotedString:
  319. return tr("Single-quoted string");
  320. case InactiveSingleQuotedString:
  321. return tr("Inactive single-quoted string");
  322. case UUID:
  323. return tr("IDL UUID");
  324. case InactiveUUID:
  325. return tr("Inactive IDL UUID");
  326. case PreProcessor:
  327. return tr("Pre-processor block");
  328. case InactivePreProcessor:
  329. return tr("Inactive pre-processor block");
  330. case Operator:
  331. return tr("Operator");
  332. case InactiveOperator:
  333. return tr("Inactive operator");
  334. case Identifier:
  335. return tr("Identifier");
  336. case InactiveIdentifier:
  337. return tr("Inactive identifier");
  338. case UnclosedString:
  339. return tr("Unclosed string");
  340. case InactiveUnclosedString:
  341. return tr("Inactive unclosed string");
  342. case VerbatimString:
  343. return tr("C# verbatim string");
  344. case InactiveVerbatimString:
  345. return tr("Inactive C# verbatim string");
  346. case Regex:
  347. return tr("JavaScript regular expression");
  348. case InactiveRegex:
  349. return tr("Inactive JavaScript regular expression");
  350. case CommentLineDoc:
  351. return tr("JavaDoc style C++ comment");
  352. case InactiveCommentLineDoc:
  353. return tr("Inactive JavaDoc style C++ comment");
  354. case KeywordSet2:
  355. return tr("Secondary keywords and identifiers");
  356. case InactiveKeywordSet2:
  357. return tr("Inactive secondary keywords and identifiers");
  358. case CommentDocKeyword:
  359. return tr("JavaDoc keyword");
  360. case InactiveCommentDocKeyword:
  361. return tr("Inactive JavaDoc keyword");
  362. case CommentDocKeywordError:
  363. return tr("JavaDoc keyword error");
  364. case InactiveCommentDocKeywordError:
  365. return tr("Inactive JavaDoc keyword error");
  366. case GlobalClass:
  367. return tr("Global classes and typedefs");
  368. case InactiveGlobalClass:
  369. return tr("Inactive global classes and typedefs");
  370. case RawString:
  371. return tr("C++ raw string");
  372. case InactiveRawString:
  373. return tr("Inactive C++ raw string");
  374. case TripleQuotedVerbatimString:
  375. return tr("Vala triple-quoted verbatim string");
  376. case InactiveTripleQuotedVerbatimString:
  377. return tr("Inactive Vala triple-quoted verbatim string");
  378. case HashQuotedString:
  379. return tr("Pike hash-quoted string");
  380. case InactiveHashQuotedString:
  381. return tr("Inactive Pike hash-quoted string");
  382. case PreProcessorComment:
  383. return tr("Pre-processor C comment");
  384. case InactivePreProcessorComment:
  385. return tr("Inactive pre-processor C comment");
  386. case PreProcessorCommentLineDoc:
  387. return tr("JavaDoc style pre-processor comment");
  388. case InactivePreProcessorCommentLineDoc:
  389. return tr("Inactive JavaDoc style pre-processor comment");
  390. case UserLiteral:
  391. return tr("User-defined literal");
  392. case InactiveUserLiteral:
  393. return tr("Inactive user-defined literal");
  394. case TaskMarker:
  395. return tr("Task marker");
  396. case InactiveTaskMarker:
  397. return tr("Inactive task marker");
  398. case EscapeSequence:
  399. return tr("Escape sequence");
  400. case InactiveEscapeSequence:
  401. return tr("Inactive escape sequence");
  402. }
  403. return QString();
  404. }
  405. // Returns the background colour of the text for a style.
  406. QColor QsciLexerCPP::defaultPaper(int style) const
  407. {
  408. switch (style)
  409. {
  410. case UnclosedString:
  411. case InactiveUnclosedString:
  412. return QColor(0xe0,0xc0,0xe0);
  413. case VerbatimString:
  414. case InactiveVerbatimString:
  415. case TripleQuotedVerbatimString:
  416. case InactiveTripleQuotedVerbatimString:
  417. return QColor(0xe0,0xff,0xe0);
  418. case Regex:
  419. case InactiveRegex:
  420. return QColor(0xe0,0xf0,0xe0);
  421. case RawString:
  422. case InactiveRawString:
  423. return QColor(0xff,0xf3,0xff);
  424. case HashQuotedString:
  425. case InactiveHashQuotedString:
  426. return QColor(0xe7,0xff,0xd7);
  427. }
  428. return QsciLexer::defaultPaper(style);
  429. }
  430. // Refresh all properties.
  431. void QsciLexerCPP::refreshProperties()
  432. {
  433. setAtElseProp();
  434. setCommentProp();
  435. setCompactProp();
  436. setPreprocProp();
  437. setStylePreprocProp();
  438. setDollarsProp();
  439. setHighlightTripleProp();
  440. setHighlightHashProp();
  441. setHighlightBackProp();
  442. setHighlightEscapeProp();
  443. setVerbatimStringEscapeProp();
  444. }
  445. // Read properties from the settings.
  446. bool QsciLexerCPP::readProperties(QSettings &qs,const QString &prefix)
  447. {
  448. fold_atelse = qs.value(prefix + "foldatelse", false).toBool();
  449. fold_comments = qs.value(prefix + "foldcomments", false).toBool();
  450. fold_compact = qs.value(prefix + "foldcompact", true).toBool();
  451. fold_preproc = qs.value(prefix + "foldpreprocessor", true).toBool();
  452. style_preproc = qs.value(prefix + "stylepreprocessor", false).toBool();
  453. dollars = qs.value(prefix + "dollars", true).toBool();
  454. highlight_triple = qs.value(prefix + "highlighttriple", false).toBool();
  455. highlight_hash = qs.value(prefix + "highlighthash", false).toBool();
  456. highlight_back = qs.value(prefix + "highlightback", false).toBool();
  457. highlight_escape = qs.value(prefix + "highlightescape", false).toBool();
  458. vs_escape = qs.value(prefix + "verbatimstringescape", false).toBool();
  459. return true;
  460. }
  461. // Write properties to the settings.
  462. bool QsciLexerCPP::writeProperties(QSettings &qs,const QString &prefix) const
  463. {
  464. qs.setValue(prefix + "foldatelse", fold_atelse);
  465. qs.setValue(prefix + "foldcomments", fold_comments);
  466. qs.setValue(prefix + "foldcompact", fold_compact);
  467. qs.setValue(prefix + "foldpreprocessor", fold_preproc);
  468. qs.setValue(prefix + "stylepreprocessor", style_preproc);
  469. qs.setValue(prefix + "dollars", dollars);
  470. qs.setValue(prefix + "highlighttriple", highlight_triple);
  471. qs.setValue(prefix + "highlighthash", highlight_hash);
  472. qs.setValue(prefix + "highlightback", highlight_back);
  473. qs.setValue(prefix + "highlightescape", highlight_escape);
  474. qs.setValue(prefix + "verbatimstringescape", vs_escape);
  475. return true;
  476. }
  477. // Set if else can be folded.
  478. void QsciLexerCPP::setFoldAtElse(bool fold)
  479. {
  480. fold_atelse = fold;
  481. setAtElseProp();
  482. }
  483. // Set the "fold.at.else" property.
  484. void QsciLexerCPP::setAtElseProp()
  485. {
  486. emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0"));
  487. }
  488. // Set if comments can be folded.
  489. void QsciLexerCPP::setFoldComments(bool fold)
  490. {
  491. fold_comments = fold;
  492. setCommentProp();
  493. }
  494. // Set the "fold.comment" property.
  495. void QsciLexerCPP::setCommentProp()
  496. {
  497. emit propertyChanged("fold.comment",(fold_comments ? "1" : "0"));
  498. }
  499. // Set if folds are compact
  500. void QsciLexerCPP::setFoldCompact(bool fold)
  501. {
  502. fold_compact = fold;
  503. setCompactProp();
  504. }
  505. // Set the "fold.compact" property.
  506. void QsciLexerCPP::setCompactProp()
  507. {
  508. emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
  509. }
  510. // Set if preprocessor blocks can be folded.
  511. void QsciLexerCPP::setFoldPreprocessor(bool fold)
  512. {
  513. fold_preproc = fold;
  514. setPreprocProp();
  515. }
  516. // Set the "fold.preprocessor" property.
  517. void QsciLexerCPP::setPreprocProp()
  518. {
  519. emit propertyChanged("fold.preprocessor",(fold_preproc ? "1" : "0"));
  520. }
  521. // Set if preprocessor lines are styled.
  522. void QsciLexerCPP::setStylePreprocessor(bool style)
  523. {
  524. style_preproc = style;
  525. setStylePreprocProp();
  526. }
  527. // Set the "styling.within.preprocessor" property.
  528. void QsciLexerCPP::setStylePreprocProp()
  529. {
  530. emit propertyChanged("styling.within.preprocessor",(style_preproc ? "1" : "0"));
  531. }
  532. // Set if '$' characters are allowed.
  533. void QsciLexerCPP::setDollarsAllowed(bool allowed)
  534. {
  535. dollars = allowed;
  536. setDollarsProp();
  537. }
  538. // Set the "lexer.cpp.allow.dollars" property.
  539. void QsciLexerCPP::setDollarsProp()
  540. {
  541. emit propertyChanged("lexer.cpp.allow.dollars",(dollars ? "1" : "0"));
  542. }
  543. // Set if triple quoted strings are highlighted.
  544. void QsciLexerCPP::setHighlightTripleQuotedStrings(bool enabled)
  545. {
  546. highlight_triple = enabled;
  547. setHighlightTripleProp();
  548. }
  549. // Set the "lexer.cpp.triplequoted.strings" property.
  550. void QsciLexerCPP::setHighlightTripleProp()
  551. {
  552. emit propertyChanged("lexer.cpp.triplequoted.strings",
  553. (highlight_triple ? "1" : "0"));
  554. }
  555. // Set if hash quoted strings are highlighted.
  556. void QsciLexerCPP::setHighlightHashQuotedStrings(bool enabled)
  557. {
  558. highlight_hash = enabled;
  559. setHighlightHashProp();
  560. }
  561. // Set the "lexer.cpp.hashquoted.strings" property.
  562. void QsciLexerCPP::setHighlightHashProp()
  563. {
  564. emit propertyChanged("lexer.cpp.hashquoted.strings",
  565. (highlight_hash ? "1" : "0"));
  566. }
  567. // Set if back-quoted strings are highlighted.
  568. void QsciLexerCPP::setHighlightBackQuotedStrings(bool enabled)
  569. {
  570. highlight_back = enabled;
  571. setHighlightBackProp();
  572. }
  573. // Set the "lexer.cpp.backquoted.strings" property.
  574. void QsciLexerCPP::setHighlightBackProp()
  575. {
  576. emit propertyChanged("lexer.cpp.backquoted.strings",
  577. (highlight_back ? "1" : "0"));
  578. }
  579. // Set if escape sequences in strings are highlighted.
  580. void QsciLexerCPP::setHighlightEscapeSequences(bool enabled)
  581. {
  582. highlight_escape = enabled;
  583. setHighlightEscapeProp();
  584. }
  585. // Set the "lexer.cpp.escape.sequence" property.
  586. void QsciLexerCPP::setHighlightEscapeProp()
  587. {
  588. emit propertyChanged("lexer.cpp.escape.sequence",
  589. (highlight_escape ? "1" : "0"));
  590. }
  591. // Set if escape sequences in verbatim strings are allowed.
  592. void QsciLexerCPP::setVerbatimStringEscapeSequencesAllowed(bool allowed)
  593. {
  594. vs_escape = allowed;
  595. setVerbatimStringEscapeProp();
  596. }
  597. // Set the "lexer.cpp.verbatim.strings.allow.escapes" property.
  598. void QsciLexerCPP::setVerbatimStringEscapeProp()
  599. {
  600. emit propertyChanged("lexer.cpp.verbatim.strings.allow.escapes",
  601. (vs_escape ? "1" : "0"));
  602. }