aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2009-11-02 05:18:27 +0000
committernyamatongwe <devnull@localhost>2009-11-02 05:18:27 +0000
commit7298d30acbac70de4873d525a69f4b74ce91361e (patch)
tree1b1a02cf939eaeb021dd933ec95d2addf6da0234
parent212257e28c87cd6ed2ff244ee6518be0c73fa342 (diff)
downloadscintilla-mirror-7298d30acbac70de4873d525a69f4b74ce91361e.tar.gz
Support for SQL Anywhere allowing "ENDIF" to terminate a fold and an option
for "EXISTS" not to.
-rw-r--r--src/LexSQL.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx
index 01aa7ad0f..7a4335bd2 100644
--- a/src/LexSQL.cxx
+++ b/src/LexSQL.cxx
@@ -231,6 +231,10 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
+ // property fold.sql.exists
+ // Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
+ bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;
+
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
@@ -303,9 +307,13 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
}
} else if (strcmp(s, "begin") == 0) {
levelNext++;
- } else if (strcmp(s, "end") == 0 ||
- // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
- strcmp(s, "exists") == 0) {
+ } else if ((strcmp(s, "end") == 0) ||
+// // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
+ (foldSqlExists && (strcmp(s, "exists") == 0)) ||
+// // SQL Anywhere permits IF ... ELSE ... ENDIF
+// // will only be active if "endif" appears in the
+// // keyword list.
+ (strcmp(s, "endif") == 0)) {
endFound = true;
levelNext--;
if (levelNext < SC_FOLDLEVELBASE) {