diff options
| -rw-r--r-- | include/KeyWords.h | 11 | ||||
| -rw-r--r-- | src/KeyWords.cxx | 29 | ||||
| -rw-r--r-- | src/LexCPP.cxx | 11 | ||||
| -rw-r--r-- | src/LexHTML.cxx | 18 | ||||
| -rw-r--r-- | src/LexPerl.cxx | 7 | ||||
| -rw-r--r-- | src/LexPython.cxx | 8 | 
6 files changed, 73 insertions, 11 deletions
| diff --git a/include/KeyWords.h b/include/KeyWords.h index fa427ff2e..df4e870c5 100644 --- a/include/KeyWords.h +++ b/include/KeyWords.h @@ -19,15 +19,22 @@ protected:  	int language;  	LexerFunction fnLexer;  	LexerFunction fnFolder; -	 +	const char * const * wordListDescriptions; +  	static const LexerModule *base;  	static int nextLanguage;  public:  	const char *languageName;  	LexerModule(int language_, LexerFunction fnLexer_,  -		const char *languageName_=0, LexerFunction fnFolder_=0); +		const char *languageName_=0, LexerFunction fnFolder_=0, +		const char * const wordListDescriptions_[] = NULL);  	int GetLanguage() const { return language; } + +	// -1 is returned if no WordList information is available +	int GetNumWordLists() const; +	const char *GetWordListDescription(int index) const; +  	virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,                    WordList *keywordlists[], Accessor &styler) const;  	virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, 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) { diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index daf95ea02..40baea9dc 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -319,5 +319,12 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordLis  	styler.SetLevel(lineCurrent, levelPrev | flagsNext);  } -LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc); -LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc); +static const char * const cppWordLists[] = { +	"Primary keywords and identifiers", +	"Secondary keywords and identifiers", +	"Documentation comment keywords", +	0, +}; + +LexerModule lmCPP(SCLEX_CPP, ColouriseCppDoc, "cpp", FoldCppDoc, cppWordLists); +LexerModule lmTCL(SCLEX_TCL, ColouriseCppDoc, "tcl", FoldCppDoc, cppWordLists); diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 67ee29c5e..d0d584634 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -1851,7 +1851,17 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo  	sc.Complete();  } -LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext"); -LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml"); -LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp"); -LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php"); +static const char * const htmlWordListDesc[] = { +	"HTML elements and attributes", +	"JavaScript keywords", +	"VBScript keywords", +	"Python keywords", +	"PHP keywords", +	"SGML and DTD keywords", +	0, +}; + +LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc); +LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc); +LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc); +LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc); diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index 76dc48de6..1715009c9 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -659,4 +659,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  	styler.ColourTo(lengthDoc - 1, state);  } -LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl"); +static const char * const perlWordListDesc[] = { +	"Perl keywords", +	0 +}; + +LexerModule lmPerl(SCLEX_PERL, ColourisePerlDoc, "perl", 0, perlWordListDesc); diff --git a/src/LexPython.cxx b/src/LexPython.cxx index 6675c1f03..01365c190 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -408,4 +408,10 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse  	//styler.SetLevel(lineCurrent, indentCurrent);  } -LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc); +static const char * const pythonWordListDesc[] = { +	"Python keywords", +	0 +}; + +LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,  +					 pythonWordListDesc); | 
