diff options
-rw-r--r-- | doc/ScintillaHistory.html | 5 | ||||
-rw-r--r-- | lexers/LexPerl.cxx | 11 | ||||
-rw-r--r-- | test/examples/perl-test-5220delta.pl.styled | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c7f71d5d9..40a768a62 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -535,7 +535,10 @@ Repetition in list assignment. <a href="http://sourceforge.net/p/scintilla/bugs/1793/">Bug #1793</a>.<br /> Highlight changed subroutine prototype syntax for Perl 5.20. - <a href="http://sourceforge.net/p/scintilla/bugs/1797/">Bug #1797</a>. + <a href="http://sourceforge.net/p/scintilla/bugs/1797/">Bug #1797</a>.<br /> + Fix module ::-syntax when special characters such as 'x' are used.<br /> + Added ' and " detection as prefix chars for x repetition operator. + <a href="http://sourceforge.net/p/scintilla/bugs/1800/">Bug #1800</a>. </li> <li> Send SCN_UPDATEUI with SC_UPDATE_SELECTION when the application changes multiple diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx index dccad1542..3b10b47e6 100644 --- a/lexers/LexPerl.cxx +++ b/lexers/LexPerl.cxx @@ -111,9 +111,11 @@ static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_Posit // &bareword: subroutine call || styler.Match(bk - 1, "->") // ->bareword: part of variable spec + || styler.Match(bk - 1, "::") + // ::bareword: part of module spec || styler.Match(bk - 2, "sub")) { - // sub bareword: subroutine declaration - // (implied BACK_KEYWORD, no keywords end in 'sub'!) + // sub bareword: subroutine declaration + // (implied BACK_KEYWORD, no keywords end in 'sub'!) result |= 1; } // next, scan forward after word past tab/spaces only; @@ -127,7 +129,7 @@ static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_Posit if ((ch == '}' && brace) // {bareword}: variable spec || styler.Match(fw, "=>")) { - // [{(, bareword=>: hash literal + // [{(, bareword=>: hash literal result |= 2; } } @@ -599,6 +601,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int CharacterSet setNonHereDoc(CharacterSet::setDigits, "=$@"); CharacterSet setHereDocDelim(CharacterSet::setAlphaNum, "_"); CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$@%&*+];_ \t"); + CharacterSet setRepetition(CharacterSet::setDigits, ")\"'"); // for format identifiers CharacterSet setFormatStart(CharacterSet::setAlpha, "_="); CharacterSet &setFormat = setHereDocDelim; @@ -1339,7 +1342,7 @@ void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int fw++; } else if (sc.ch == 'x' && (sc.chNext == '=' || // repetition !setWord.Contains(sc.chNext) || - ((IsADigit(sc.chPrev) || sc.chPrev == ')') && IsADigit(sc.chNext)))) { + (setRepetition.Contains(sc.chPrev) && IsADigit(sc.chNext)))) { sc.ChangeState(SCE_PL_OPERATOR); } // if potentially a keyword, scan forward and grab word, then check diff --git a/test/examples/perl-test-5220delta.pl.styled b/test/examples/perl-test-5220delta.pl.styled index c01757999..3754c8929 100644 --- a/test/examples/perl-test-5220delta.pl.styled +++ b/test/examples/perl-test-5220delta.pl.styled @@ -105,7 +105,7 @@ {5}sub{0} {11}foo{0} {10}:{0} {11}lvalue{0} {10};{0} {5}package{0} {11}X{10};{0} -{5}sub{0} {11}Y{10}::x{0} {10}:{0} {11}lvalue{0} {10}{{0} {4}1{0} {10}}{0} +{5}sub{0} {11}Y{10}::{11}x{0} {10}:{0} {11}lvalue{0} {10}{{0} {4}1{0} {10}}{0} {5}package{0} {11}X{10};{0} {5}sub{0} {11}foo{0} {10}{{0} {4}1{0} {10}}{0} |