aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r--lexers/LexCPP.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index a78fcc003..ab982bb4b 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -306,6 +306,7 @@ struct OptionsCPP {
bool identifiersAllowDollars;
bool trackPreprocessor;
bool updatePreprocessor;
+ bool verbatimStringsAllowEscapes;
bool triplequotedStrings;
bool hashquotedStrings;
bool backQuotedStrings;
@@ -326,6 +327,7 @@ struct OptionsCPP {
identifiersAllowDollars = true;
trackPreprocessor = true;
updatePreprocessor = true;
+ verbatimStringsAllowEscapes = false;
triplequotedStrings = false;
hashquotedStrings = false;
backQuotedStrings = false;
@@ -370,6 +372,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor,
"Set to 1 to update preprocessor definitions when #define found.");
+ DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes,
+ "Set to 1 to allow verbatim strings to contain escape sequences.");
+
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
"Set to 1 to enable highlighting of triple-quoted strings.");
@@ -1036,7 +1041,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_C_VERBATIM:
- if (sc.ch == '\"') {
+ if (options.verbatimStringsAllowEscapes && (sc.ch == '\\')) {
+ sc.Forward(); // Skip all characters after the backslash
+ } else if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {