From b501aa00d3f8a5d4f4b97e13243612c8952ca60a Mon Sep 17 00:00:00 2001 From: Yury Dubinsky Date: Tue, 5 May 2020 08:35:48 +1000 Subject: Fixed bug where a single character line with a single character line end continued state onto the next line. --- doc/ScintillaHistory.html | 4 ++++ lexers/LexBatch.cxx | 25 +++++++++++++++---------- lexilla/test/examples/batch/x.bat | 5 +++++ lexilla/test/examples/batch/x.bat.styled | 5 +++++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index b85acdd74..0827120c6 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -574,6 +574,10 @@ Feature #1347.
  • + Fixed bug in Batch lexer where a single character line with a single character line end continued + state onto the next line. +
  • +
  • Added SCE_ERR_GCC_EXCERPT style for GCC 9 diagnostics in errorlist lexer.
  • diff --git a/lexers/LexBatch.cxx b/lexers/LexBatch.cxx index ee71c528f..857b60ce6 100644 --- a/lexers/LexBatch.cxx +++ b/lexers/LexBatch.cxx @@ -543,17 +543,22 @@ static void ColouriseBatchDoc( // Colorize Default Text for remainder of line - currently not lexed styler.ColourTo(endPos, SCE_BAT_DEFAULT); - // handle line continuation for SET and ECHO commands except the last line and an empty line - if (!continueProcessing && (i2) { - Sci_PositionU lineContinuationPos; - if (lineBuffer[linePos-2]=='\r') // Windows EOL - lineContinuationPos=linePos-3; - else - lineContinuationPos=linePos-2; // Unix or Mac EOL - if ((lineBuffer[lineContinuationPos]!='^') || // handle '^' line continuation - IsEscaped(lineBuffer, lineContinuationPos) - || textQuoted(lineBuffer, lineContinuationPos)) + // handle line continuation for SET and ECHO commands except the last line + if (!continueProcessing && (i2) && lineBuffer[linePos-2]=='\r') // Windows EOL + lineContinuationPos=linePos-3; + else + lineContinuationPos=linePos-2; // Unix or Mac EOL + // Reset continueProcessing if line continuation was not found + if ((lineBuffer[lineContinuationPos]!='^') + || IsEscaped(lineBuffer, lineContinuationPos) + || textQuoted(lineBuffer, lineContinuationPos)) continueProcessing=true; + } } linePos = 0; diff --git a/lexilla/test/examples/batch/x.bat b/lexilla/test/examples/batch/x.bat index 60eab1116..916efd36a 100644 --- a/lexilla/test/examples/batch/x.bat +++ b/lexilla/test/examples/batch/x.bat @@ -31,4 +31,9 @@ IF NOT DEFINED var (SET var=1) :: Bug 2065: keywords not recognized when followed by ')' @if exist a ( exit) +:: Bug: with \r or \n, 'command' is seen as continuation +echo word ^ +1 +command + :END diff --git a/lexilla/test/examples/batch/x.bat.styled b/lexilla/test/examples/batch/x.bat.styled index 07f903338..02d1ffcc8 100644 --- a/lexilla/test/examples/batch/x.bat.styled +++ b/lexilla/test/examples/batch/x.bat.styled @@ -31,4 +31,9 @@ rem 'echo' is word=2, 'a' is default=0 {1}:: Bug 2065: keywords not recognized when followed by ')' {4}@{2}if exist{0} a ({2} exit{0}) +{1}:: Bug: with \r or \n, 'command' is seen as continuation +{2}echo{0} word ^ +1 +{5}command{0} + {3}:END -- cgit v1.2.3