diff options
| author | nyamatongwe <devnull@localhost> | 2010-11-16 08:54:26 +1100 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2010-11-16 08:54:26 +1100 | 
| commit | e301ee4cfb962802f6d3eb9cdcb757ec6e06a70e (patch) | |
| tree | 369a35c428bfa457b937e2ad58d033e941213c90 | |
| parent | 7d81123813d0364e6c2e7422bfca663b12050a6b (diff) | |
| download | scintilla-mirror-e301ee4cfb962802f6d3eb9cdcb757ec6e06a70e.tar.gz | |
Feature #3108351. Enable fold.at.else for SQL. From Jérôme LAFORGE.
| -rw-r--r-- | lexers/LexSQL.cxx | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx index 14785ed49..872eb9f6a 100644 --- a/lexers/LexSQL.cxx +++ b/lexers/LexSQL.cxx @@ -2,7 +2,7 @@  /** @file LexSQL.cxx   ** Lexer for SQL, including PL/SQL and SQL*Plus.   **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> +// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed.  #include <stdlib.h> @@ -239,6 +239,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  	bool foldComment = styler.GetPropertyInt("fold.comment") != 0;  	bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;  	bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; +	bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;  	// property fold.sql.exists  	//	Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS". @@ -312,11 +313,16 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  				strcmp(s, "loop") == 0 ||  				strcmp(s, "case") == 0)) {  				if (endFound) { -					// ignore +					// ignore because we are into "end if;" or "end loop;" or "end case;"  					endFound = false;  				} else {  					levelNext++;  				} +			} else if ((!foldOnlyBegin) && ( +				// folding for else & elsif block only if foldAtElse is set. +				foldAtElse && (strcmp(s, "elsif") == 0 || strcmp(s, "else") == 0))) { +				// we are in same case "} else {" in C language +				levelCurrent--;  			} else if (strcmp(s, "begin") == 0) {  				levelNext++;  			} else if ((strcmp(s, "end") == 0) || | 
