aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexCPP.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-09-22 09:44:09 +1000
committernyamatongwe <devnull@localhost>2011-09-22 09:44:09 +1000
commit11c898e23470322d87648064dd92016c2a57f76a (patch)
tree43a4b945125e9e9560a24a6129b670dde12a7512 /lexers/LexCPP.cxx
parent81d65369fc316e08963c4385bd3b28f1f3a4d016 (diff)
downloadscintilla-mirror-11c898e23470322d87648064dd92016c2a57f76a.tar.gz
Hashquoted strings for Pike language from Chris Angelico.
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);