From c012e84b6c2cab27d3a5e289cddc628596183f29 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 6 Feb 2014 08:04:20 +1100 Subject: Fix crashes and other bugs by removing folding of do-label constructs. --- lexers/LexFortran.cxx | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) (limited to 'lexers') diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx index 3410acb40..a91828289 100644 --- a/lexers/LexFortran.cxx +++ b/lexers/LexFortran.cxx @@ -323,10 +323,6 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, /***************************************/ int lastStart = 0; char prevWord[32] = ""; - char Label[6] = ""; - // Variables for do label folding. - static int doLabels[100]; - static int posLabel=-1; /***************************************/ for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; @@ -427,7 +423,8 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, } } } else { - levelDeltaNext += classifyFoldPointFortran(s, prevWord, chNextNonBlank); + int wordLevelDelta = classifyFoldPointFortran(s, prevWord, chNextNonBlank); + levelDeltaNext += wordLevelDelta; if (((strcmp(s, "else") == 0) && (nextEOL || chNextNonBlank == '!')) || (strcmp(prevWord, "else") == 0 && strcmp(s, "where") == 0) || strcmp(s, "elsewhere") == 0) { if (!isPrevLine) { @@ -453,38 +450,16 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, levelDeltaNext -= 2; } - // Store the do Labels into array + // There are multiple forms of "do" loop. The older form with a label "do 100 i=1,10" would require matching + // labels to ensure the folding level does not decrease too far when labels are used for other purposes. + // Since this is difficult, do-label constructs are not folded. if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) { - unsigned int k = 0; - for (i=j; (i -1) { - levelCurrent--; - posLabel--; - } - } } if (atEOL) { int lev = levelCurrent; -- cgit v1.2.3