aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexSQL.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2005-10-21 00:06:57 +0000
committernyamatongwe <devnull@localhost>2005-10-21 00:06:57 +0000
commit83f5a42086d9db3941d12b75477f13f7f9e35655 (patch)
tree3f705d39561dcf027fbd2d26c740c481c93e465c /src/LexSQL.cxx
parenta2974344c76ff333a5a8edca58d261bc7afc68a0 (diff)
downloadscintilla-mirror-83f5a42086d9db3941d12b75477f13f7f9e35655.tar.gz
Patch from Iago implements new quoted identifier lexical class for SQL.
Diffstat (limited to 'src/LexSQL.cxx')
-rw-r--r--src/LexSQL.cxx29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx
index 6f2a703fb..b1b2c1624 100644
--- a/src/LexSQL.cxx
+++ b/src/LexSQL.cxx
@@ -109,7 +109,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
bool fold = styler.GetPropertyInt("fold") != 0;
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
- bool sqlBackticksString = styler.GetPropertyInt("sql.backticks.string", 0) != 0;
+ bool sqlBackticksIdentifier = styler.GetPropertyInt("sql.backticks.identifier", 0) != 0;
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
@@ -170,9 +170,12 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_SQL_CHARACTER;
- } else if (ch == '"' || (sqlBackticksString && ch == 0x60)) {
+ } else if (ch == '"') {
styler.ColourTo(i - 1, state);
state = SCE_SQL_STRING;
+ } else if (ch == 0x60 && sqlBackticksIdentifier) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_SQL_QUOTEDIDENTIFIER;
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_SQL_OPERATOR);
@@ -193,8 +196,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_SQL_COMMENTLINEDOC;
} else if (ch == '\'') {
state = SCE_SQL_CHARACTER;
- } else if (ch == '"' || (sqlBackticksString && ch == 0x60)) {
+ } else if (ch == '"') {
state = SCE_SQL_STRING;
+ } else if (ch == 0x60 && sqlBackticksIdentifier) {
+ state = SCE_SQL_QUOTEDIDENTIFIER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_SQL_OPERATOR);
}
@@ -262,7 +267,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_SQL_STRING) {
- if (ch == '"' || (sqlBackticksString && ch == 0x60)) {
+ if (ch == '"') {
if (chNext == '"') {
i++;
} else {
@@ -273,6 +278,18 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
+ } else if (state == SCE_SQL_QUOTEDIDENTIFIER) {
+ if (ch == 0x60) {
+ if (chNext == 0x60) {
+ i++;
+ } else {
+ styler.ColourTo(i, state);
+ state = SCE_SQL_DEFAULT;
+ i++;
+ }
+ ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ }
}
if (state == SCE_SQL_DEFAULT) { // One of the above succeeded
if (ch == '/' && chNext == '*') {
@@ -291,8 +308,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_SQL_SQLPLUS_PROMPT;
} else if (ch == '\'') {
state = SCE_SQL_CHARACTER;
- } else if (ch == '"' || (sqlBackticksString && ch == 0x60)) {
+ } else if (ch == '"') {
state = SCE_SQL_STRING;
+ } else if (ch == 0x60 && sqlBackticksIdentifier) {
+ state = SCE_SQL_QUOTEDIDENTIFIER;
} else if (iswordstart(ch)) {
state = SCE_SQL_WORD;
} else if (isoperator(ch)) {