diff options
-rw-r--r-- | include/SciLexer.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | src/LexPerl.cxx | 35 |
3 files changed, 25 insertions, 12 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h index 44e312ae2..12df254e9 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -263,6 +263,7 @@ #define SCE_PL_STRING_QX 28 #define SCE_PL_STRING_QR 29 #define SCE_PL_STRING_QW 30 +#define SCE_PL_POD_VERB 31 #define SCE_B_DEFAULT 0 #define SCE_B_COMMENT 1 #define SCE_B_NUMBER 2 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 9193eeff1..eb150b5a4 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2007,6 +2007,7 @@ val SCE_PL_STRING_QQ=27 val SCE_PL_STRING_QX=28 val SCE_PL_STRING_QR=29 val SCE_PL_STRING_QW=30 +val SCE_PL_POD_VERB=31 # Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC lex VB=SCLEX_VB SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_ diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index ed680e0ce..d6a34b910 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -2,8 +2,8 @@ /** @file LexPerl.cxx ** Lexer for subset of Perl. **/ -// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my> 2003-2004 -// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> +// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> +// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my> // The License.txt file describes the conditions under which this software may be distributed. #include <stdlib.h> @@ -497,6 +497,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, // other styles uses the default, preferRE=false case SCE_PL_WORD: case SCE_PL_POD: + case SCE_PL_POD_VERB: case SCE_PL_HERE_Q: case SCE_PL_HERE_QQ: case SCE_PL_HERE_QX: @@ -755,15 +756,25 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle, } chNext = styler.SafeGetCharAt(i + 1); } - } else if (state == SCE_PL_POD) { - if (ch == '=' && isEOLChar(chPrev)) { - if (isMatch(styler, lengthDoc, i, "=cut")) { - styler.ColourTo(i - 1 + 4, state); - i += 4; - state = SCE_PL_DEFAULT; - ch = styler.SafeGetCharAt(i); - //chNext = styler.SafeGetCharAt(i + 1); - goto restartLexer; + } else if (state == SCE_PL_POD + || state == SCE_PL_POD_VERB) { + if (isEOLChar(chPrev)) { + if (ch ==' ' || ch == '\t') { + styler.ColourTo(i - 1, state); + state = SCE_PL_POD_VERB; + } else { + styler.ColourTo(i - 1, state); + state = SCE_PL_POD; + if (ch == '=') { + if (isMatch(styler, lengthDoc, i, "=cut")) { + styler.ColourTo(i - 1 + 4, state); + i += 4; + state = SCE_PL_DEFAULT; + ch = styler.SafeGetCharAt(i); + //chNext = styler.SafeGetCharAt(i + 1); + goto restartLexer; + } + } } } } else if (state == SCE_PL_SCALAR // variable names @@ -967,7 +978,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[], if (foldPOD && atLineStart) { int stylePrevCh = (i) ? styler.StyleAt(i - 1):SCE_PL_DEFAULT; if (style == SCE_PL_POD) { - if (stylePrevCh != SCE_PL_POD) + if (stylePrevCh != SCE_PL_POD && stylePrevCh != SCE_PL_POD_VERB) levelCurrent++; else if (styler.Match(i, "=cut")) levelCurrent--; |