diff options
author | darmar <unknown> | 2017-04-18 09:32:34 +1000 |
---|---|---|
committer | darmar <unknown> | 2017-04-18 09:32:34 +1000 |
commit | 4d6694eccc5db0f9748cbda9152cec7b3c916169 (patch) | |
tree | 276c0c852e55a2e95b8fa280115816930f1201e1 | |
parent | 602902a69c52c8db02b376853800694868d6e65d (diff) | |
download | scintilla-mirror-4d6694eccc5db0f9748cbda9152cec7b3c916169.tar.gz |
Bug [#1935]. Recognize a preprocessor line after a line continuation.
-rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
-rw-r--r-- | lexers/LexFortran.cxx | 22 |
2 files changed, 17 insertions, 9 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index e1ba4e841..47ab6305d 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -537,6 +537,10 @@ Updated case conversion and character categories to Unicode 9. </li> <li> + The Fortran lexer recognizes a preprocessor line after a line continuation &. + <a href="http://sourceforge.net/p/scintilla/bugs/1935/">Bug #1935</a>. + </li> + <li> The PowerShell lexer recognizes escaped quotes in strings. <a href="http://sourceforge.net/p/scintilla/bugs/1929/">Bug #1929</a>. </li> diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx index 37e0b45c5..641702893 100644 --- a/lexers/LexFortran.cxx +++ b/lexers/LexFortran.cxx @@ -120,14 +120,6 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int continue; } /***************************************/ - // Hanndle preprocessor directives - if (sc.ch == '#' && numNonBlank == 1) - { - sc.SetState(SCE_F_PREPROCESSOR); - while (!sc.atLineEnd && sc.More()) - sc.Forward(); // Until line end - } - /***************************************/ // Handle line continuation generically. if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) { char chTemp = ' '; @@ -143,7 +135,11 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int int currentState = sc.state; sc.SetState(SCE_F_CONTINUATION); sc.ForwardSetState(SCE_F_DEFAULT); - while (IsASpace(sc.ch) && sc.More()) sc.Forward(); + while (IsASpace(sc.ch) && sc.More()) { + sc.Forward(); + if (sc.atLineStart) numNonBlank = 0; + if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; + } if (sc.ch == '&') { sc.SetState(SCE_F_CONTINUATION); sc.Forward(); @@ -152,6 +148,14 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int } } /***************************************/ + // Hanndle preprocessor directives + if (sc.ch == '#' && numNonBlank == 1) + { + sc.SetState(SCE_F_PREPROCESSOR); + while (!sc.atLineEnd && sc.More()) + sc.Forward(); // Until line end + } + /***************************************/ // Determine if the current state should terminate. if (sc.state == SCE_F_OPERATOR) { sc.SetState(SCE_F_DEFAULT); |