diff options
author | nyamatongwe <devnull@localhost> | 2005-03-12 13:00:10 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2005-03-12 13:00:10 +0000 |
commit | 5d6d3ae3b42cecbc2155e7a559c331e9620f6d05 (patch) | |
tree | 0b84f711b8b319d6ef11fb71316d76105bdb24a7 | |
parent | 3a45d8a6a1ced9065d50d4a20907096ae4162a67 (diff) | |
download | scintilla-mirror-5d6d3ae3b42cecbc2155e7a559c331e9620f6d05.tar.gz |
Patch from Michael Owens to add a second set of keywords.
-rw-r--r-- | src/LexSQL.cxx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx index 8383eefb0..bb8f128da 100644 --- a/src/LexSQL.cxx +++ b/src/LexSQL.cxx @@ -19,19 +19,28 @@ #include "Scintilla.h" #include "SciLexer.h" -static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static void classifyWordSQL(unsigned int start, unsigned int end, WordList *keywordlists[], Accessor &styler) { char s[100]; bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast<char>(tolower(styler[start + i])); s[i + 1] = '\0'; } + + WordList &keywords1 = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + char chAttr = SCE_C_IDENTIFIER; if (wordIsNumber) chAttr = SCE_C_NUMBER; else { - if (keywords.InList(s)) + if (keywords1.InList(s)) { chAttr = SCE_C_WORD; + } + + if (keywords2.InList(s)) { + chAttr = SCE_C_WORD2; + } } styler.ColourTo(end, chAttr); } @@ -39,8 +48,6 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { - WordList &keywords = *keywordlists[0]; - styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold") != 0; @@ -104,7 +111,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, } } else if (state == SCE_C_WORD) { if (!iswordchar(ch)) { - classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler); + classifyWordSQL(styler.GetStartSegment(), i - 1, keywordlists, styler); state = SCE_C_DEFAULT; if (ch == '/' && chNext == '*') { state = SCE_C_COMMENT; @@ -188,6 +195,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, static const char * const sqlWordListDesc[] = { "Keywords", + "Database Objects", 0 }; |