From 550e7b2728fed60bc3455c59580a7109fdba2cc9 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 13 Oct 2003 11:52:53 +0000 Subject: Separated single quote and double quote string styles. --- src/LexSQL.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx index 3f65b1209..144176855 100644 --- a/src/LexSQL.cxx +++ b/src/LexSQL.cxx @@ -88,7 +88,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, } else if (ch == '-' && chNext == '-') { styler.ColourTo(i - 1, state); state = SCE_C_COMMENTLINE; - } else if ((ch == '\'') || (ch == '"')) { + } else if (ch == '\'') { + styler.ColourTo(i - 1, state); + state = SCE_C_CHARACTER; + } else if (ch == '"') { styler.ColourTo(i - 1, state); state = SCE_C_STRING; } else if (isoperator(ch)) { @@ -103,7 +106,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, state = SCE_C_COMMENT; } else if (ch == '-' && chNext == '-') { state = SCE_C_COMMENTLINE; - } else if ((ch == '\'') || (ch == '"')) { + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '"') { state = SCE_C_STRING; } else if (isoperator(ch)) { styler.ColourTo(i, SCE_C_OPERATOR); @@ -123,7 +128,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, styler.ColourTo(i - 1, state); state = SCE_C_DEFAULT; } - } else if (state == SCE_C_STRING) { + } else if (state == SCE_C_CHARACTER) { if (ch == '\'') { if ( chNext == '\'' ) { i++; @@ -134,7 +139,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, } ch = chNext; chNext = styler.SafeGetCharAt(i + 1); - } else if (ch == '"') { + } + } else if (state == SCE_C_STRING) { + if (ch == '"') { if (chNext == '"') { i++; } else { @@ -151,7 +158,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, state = SCE_C_COMMENT; } else if (ch == '-' && chNext == '-') { state = SCE_C_COMMENTLINE; - } else if ((ch == '\'') || (ch == '"')) { + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (ch == '"') { state = SCE_C_STRING; } else if (iswordstart(ch)) { state = SCE_C_WORD; -- cgit v1.2.3