aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-01-24 12:25:51 +1100
committerNeil <nyamatongwe@gmail.com>2015-01-24 12:25:51 +1100
commitb42b286f8818b5ab7f2886dc549c75d03d8e4982 (patch)
tree0736306d47dd753a203489923bc7cd7adae99e7a
parentc2cfd294d21e6da8a86191bdd00af0772379737c (diff)
downloadscintilla-mirror-b42b286f8818b5ab7f2886dc549c75d03d8e4982.tar.gz
Fix a bug with the q-quote operator.
From Michael Staszewski.
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--lexers/LexSQL.cxx50
2 files changed, 30 insertions, 23 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 9efc5c982..ecbc5fc79 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -490,6 +490,9 @@
<a href="http://sourceforge.net/p/scintilla/bugs/1098/">Bug #1098</a>.
</li>
<li>
+ SQL lexer fixes a bug with the q-quote operator.
+ </li>
+ <li>
Add new indicator INDIC_COMPOSITIONTHIN to mimic the appearance of non-target segments
in OS X IME.
</li>
diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx
index b9f15ea1a..9e1a19748 100644
--- a/lexers/LexSQL.cxx
+++ b/lexers/LexSQL.cxx
@@ -444,7 +444,6 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
int offset = 0;
- char qOperator = 0x00;
for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate.
@@ -559,29 +558,34 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_SQL_QOPERATOR:
- if (qOperator == 0x00) {
- qOperator = sc.ch;
- } else {
- char qComplement = 0x00;
-
- if (qOperator == '<') {
- qComplement = '>';
- } else if (qOperator == '(') {
- qComplement = ')';
- } else if (qOperator == '{') {
- qComplement = '}';
- } else if (qOperator == '[') {
- qComplement = ']';
- } else {
- qComplement = qOperator;
- }
-
- if (sc.Match(qComplement, '\'')) {
- sc.Forward();
- sc.ForwardSetState(SCE_SQL_DEFAULT);
- qOperator = 0x00;
+ // Locate the unique Q operator character
+ sc.Complete();
+ char qOperator = 0x00;
+ for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
+ if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) {
+ qOperator = styler.SafeGetCharAt(styleStartPos + 2);
+ break;
}
- }
+ }
+
+ char qComplement = 0x00;
+
+ if (qOperator == '<') {
+ qComplement = '>';
+ } else if (qOperator == '(') {
+ qComplement = ')';
+ } else if (qOperator == '{') {
+ qComplement = '}';
+ } else if (qOperator == '[') {
+ qComplement = ']';
+ } else {
+ qComplement = qOperator;
+ }
+
+ if (sc.Match(qComplement, '\'')) {
+ sc.Forward();
+ sc.ForwardSetState(SCE_SQL_DEFAULT);
+ }
break;
}