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 | |
| 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')
| -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 | 
5 files changed, 64 insertions, 9 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) { 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); | 
