aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'lexers/LexCPP.cxx')
-rw-r--r--lexers/LexCPP.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 51fd19255..5cc2f4556 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -209,6 +209,7 @@ struct OptionsCPP {
bool trackPreprocessor;
bool updatePreprocessor;
bool triplequotedStrings;
+ bool hashquotedStrings;
bool fold;
bool foldSyntaxBased;
bool foldComment;
@@ -226,6 +227,7 @@ struct OptionsCPP {
trackPreprocessor = true;
updatePreprocessor = true;
triplequotedStrings = false;
+ hashquotedStrings = false;
fold = false;
foldSyntaxBased = true;
foldComment = false;
@@ -268,6 +270,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
"Set to 1 to enable highlighting of triple-quoted strings.");
+ DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
+ "Set to 1 to enable highlighting of hash-quoted strings.");
+
DefineProperty("fold", &OptionsCPP::fold);
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
@@ -692,6 +697,15 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
}
break;
+ case SCE_C_HASHQUOTEDSTRING:
+ if (sc.ch == '\\') {
+ if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
+ sc.Forward();
+ }
+ } else if (sc.ch == '\"') {
+ sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
+ }
+ break;
case SCE_C_STRINGRAW:
if (sc.Match(rawStringTerminator.c_str())) {
for (size_t termPos=rawStringTerminator.size(); termPos; termPos--)
@@ -768,6 +782,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (options.triplequotedStrings && sc.Match("\"\"\"")) {
sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet);
sc.Forward(2);
+ } else if (options.hashquotedStrings && sc.Match('#', '\"')) {
+ sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
+ sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID|activitySet);