diff options
author | nyamatongwe <unknown> | 2010-11-16 08:54:26 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2010-11-16 08:54:26 +1100 |
commit | 3c493786a0dec71c0854eedc959127cd3aec0bda (patch) | |
tree | af33de6937236339f360ab43e196564014e5a41b | |
parent | e979ac31426b5ec77e9999a81481ed69dabef2bc (diff) | |
download | scintilla-mirror-3c493786a0dec71c0854eedc959127cd3aec0bda.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) || |