diff options
author | nyamatongwe <devnull@localhost> | 2002-04-03 01:58:48 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2002-04-03 01:58:48 +0000 |
commit | 154254a66aebb4cf40616c0a80c1b57c5560d3c8 (patch) | |
tree | 7117f177a62465861a86aa3ef40473032d1e687b /src/KeyWords.cxx | |
parent | 8947d717a43f3026cf3d246e43698d7ba266feaf (diff) | |
download | scintilla-mirror-154254a66aebb4cf40616c0a80c1b57c5560d3c8.tar.gz |
Patch from Brian Quinlan to include metdata about keyword lists within
lexers.
Diffstat (limited to 'src/KeyWords.cxx')
-rw-r--r-- | src/KeyWords.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/KeyWords.cxx b/src/KeyWords.cxx index d1eddef5f..e75fc9d01 100644 --- a/src/KeyWords.cxx +++ b/src/KeyWords.cxx @@ -23,10 +23,12 @@ const LexerModule *LexerModule::base = 0; int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1; LexerModule::LexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_, LexerFunction fnFolder_) : + const char *languageName_, LexerFunction fnFolder_, + const char * const wordListDescriptions_[]) : language(language_), fnLexer(fnLexer_), fnFolder(fnFolder_), + wordListDescriptions(wordListDescriptions_), languageName(languageName_) { next = base; base = this; @@ -36,6 +38,31 @@ LexerModule::LexerModule(int language_, LexerFunction fnLexer_, } } +int LexerModule::GetNumWordLists() const { + if (wordListDescriptions == NULL) { + return -1; + } else { + int numWordLists = 0; + + while (wordListDescriptions[numWordLists]) { + ++numWordLists; + } + + return numWordLists; + } +} + +const char * LexerModule::GetWordListDescription(int index) const { + static const char *emptyStr = ""; + + PLATFORM_ASSERT(index < GetNumWordLists()); + if (index >= GetNumWordLists()) { + return emptyStr; + } else { + return wordListDescriptions[index]; + } +} + const LexerModule *LexerModule::Find(int language) { const LexerModule *lm = base; while (lm) { |