aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2004-05-03 11:49:22 +0000
committernyamatongwe <unknown>2004-05-03 11:49:22 +0000
commit89856486bcd877b71dab79db5575a7b393e32b4b (patch)
treecf1aa7727520d7f70f69ed7130c81941fc2bebf9
parenta9c5f9a00f8da37d12c84bd9d85c55c3cb9bdbe4 (diff)
downloadscintilla-mirror-89856486bcd877b71dab79db5575a7b393e32b4b.tar.gz
Allow backslash quoting in strings when sql.backslash.escapes
turned on.
-rw-r--r--src/LexSQL.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx
index 144176855..8383eefb0 100644
--- a/src/LexSQL.cxx
+++ b/src/LexSQL.cxx
@@ -44,6 +44,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold") != 0;
+ bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
@@ -88,6 +89,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
} else if (ch == '-' && chNext == '-') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINE;
+ } else if (ch == '#') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_C_CHARACTER;
@@ -106,6 +110,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
+ } else if (ch == '#') {
+ state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '"') {
@@ -123,14 +129,18 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_C_DEFAULT;
}
}
- } else if (state == SCE_C_COMMENTLINE) {
+ } else if (state == SCE_C_COMMENTLINE || state == SCE_C_COMMENTLINEDOC) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
- if (ch == '\'') {
- if ( chNext == '\'' ) {
+ if (sqlBackslashEscapes && ch == '\\') {
+ i++;
+ ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ } else if (ch == '\'') {
+ if (chNext == '\'') {
i++;
} else {
styler.ColourTo(i, state);
@@ -158,6 +168,8 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
+ } else if (ch == '#') {
+ state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '"') {