aboutsummaryrefslogtreecommitdiffhomepage
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
parenta2974344c76ff333a5a8edca58d261bc7afc68a0 (diff)
downloadscintilla-mirror-83f5a42086d9db3941d12b75477f13f7f9e35655.tar.gz
Patch from Iago implements new quoted identifier lexical class for SQL.
-rw-r--r--include/SciLexer.h1
-rw-r--r--include/Scintilla.iface1
-rw-r--r--src/LexSQL.cxx29
3 files changed, 26 insertions, 5 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h
index 5d52de6c4..5b24fee58 100644
--- a/include/SciLexer.h
+++ b/include/SciLexer.h
@@ -949,6 +949,7 @@
#define SCE_SQL_USER2 20
#define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22
+#define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index d1e63b07e..b02a4a7c4 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2799,6 +2799,7 @@ val SCE_SQL_USER1=19
val SCE_SQL_USER2=20
val SCE_SQL_USER3=21
val SCE_SQL_USER4=22
+val SCE_SQL_QUOTEDIDENTIFIER=23
# Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0
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)) {