diff options
author | Mark Reay <mark@reay.net.au> | 2020-01-04 22:37:08 +0000 |
---|---|---|
committer | Mark Reay <mark@reay.net.au> | 2020-01-04 22:37:08 +0000 |
commit | 47e66559b53ec48b39fc1e66a407339dfe98451b (patch) | |
tree | b6940ef66db799b328d8e96572aaf149c246b7b8 | |
parent | eb4ee1f609cbd9f6adb0645beb19820586d19461 (diff) | |
download | scintilla-mirror-47e66559b53ec48b39fc1e66a407339dfe98451b.tar.gz |
Feature [feature-requests:#1328] Handle CRLF in SCE_RAKU_COMMENTLINEs and
HEREDOCs style termination.
-rw-r--r-- | lexers/LexRaku.cxx | 9 | ||||
-rw-r--r-- | lexilla/test/examples/raku/x.p6.styled | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/lexers/LexRaku.cxx b/lexers/LexRaku.cxx index a06a573bb..17fff5e94 100644 --- a/lexers/LexRaku.cxx +++ b/lexers/LexRaku.cxx @@ -892,6 +892,7 @@ void LexerRaku::ProcessStringVars(StyleContext &sc, const Sci_Position length, c bool LexerRaku::ProcessValidRegQlangStart(StyleContext &sc, Sci_Position length, const int type, WordList &wordsAdverbs, DelimPair &dp) { Sci_Position startPos = sc.currentPos; + Sci_Position startLen = length; const int target_state = sc.state; int state = SCE_RAKU_DEFAULT; std::string str; @@ -908,7 +909,7 @@ bool LexerRaku::ProcessValidRegQlangStart(StyleContext &sc, Sci_Position length, if (!got_all_adverbs && was_space) { sc.Forward(LengthToNextChar(sc, length)); } - length -= sc.currentPos - startPos; // update length remaining + length = startLen - (sc.currentPos - startPos); // update length remaining // parse / eat an identifier (if type == RAKUTYPE_REGEX) if (dp.opener == 0 && !got_ident && type == RAKUTYPE_REGEX && IsAlphabet(sc.ch)) { @@ -1067,7 +1068,7 @@ void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int sc.SetState(SCE_RAKU_DEFAULT); break; // FIXME: better valid operator sequences needed? case SCE_RAKU_COMMENTLINE: - if (sc.atLineEnd) { + if (IsANewLine(sc.ch)) { sc.SetState(SCE_RAKU_DEFAULT); } break; @@ -1424,7 +1425,9 @@ void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int } // --- Heredoc: begin --------------------------------------------- - else if (sc.atLineEnd && !hereDelim.empty()) { + else if (!hereDelim.empty() && sc.atLineEnd) { + if (IsANewLine(sc.ch)) + sc.Forward(); // skip a possible CRLF situation sc.SetState(hereState); } diff --git a/lexilla/test/examples/raku/x.p6.styled b/lexilla/test/examples/raku/x.p6.styled index 9bef97940..f23902104 100644 --- a/lexilla/test/examples/raku/x.p6.styled +++ b/lexilla/test/examples/raku/x.p6.styled @@ -21,14 +21,14 @@ POD Documentation... =end pod{0} -{20}say{0} {10}qq{15}:to{10}/END/{18};{7} -A multi-line +{20}say{0} {10}qq{15}:to{10}/END/{18};{0} +{7}A multi-line string with interpolated vars: {12}$i{7}, {12}$r{7} END{0} {20}sub{0} {21}function{0} {18}{{0} - {20}return{0} {9}q{15}:to{9}/END/{18};{6} -Here is + {20}return{0} {9}q{15}:to{9}/END/{18};{0} +{6}Here is some multi-line string END{0} |