aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/KeyWords.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-04-03 01:58:48 +0000
committernyamatongwe <unknown>2002-04-03 01:58:48 +0000
commite629b52ab137c88838eaa47a8f712630f5441fc8 (patch)
tree7117f177a62465861a86aa3ef40473032d1e687b /src/KeyWords.cxx
parent412494ade67e33739a50d207ad644b14fbff59f9 (diff)
downloadscintilla-mirror-e629b52ab137c88838eaa47a8f712630f5441fc8.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.cxx29
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) {