[QScintilla] Unable to add new keywords into already existing lexers.
Sarbojit Sarkar
sarkar.iitr at gmail.com
Wed Feb 22 06:34:56 GMT 2012
Hi,
I have started playing with QScintilla few days back and I am quite happy
to see broad range of already existing lexers. Now I have a requirement
where I am planning to add few keywords into existing lexer. By googling it
seems that I have to create a subclass and need to redefine "const char*
keywords(int set) const" function. I did that but did not observer any
change. Here is my code,
class myLex : public QsciLexerCPP
{
public:
const char* keywords(int set) const;
};
const char* myLex::keywords(int set) const
{
if (set == 1)
return
"and and_eq asm auto bitand bitor bool break case "
"catch char class compl const const_cast continue "
"default delete do double dynamic_cast else enum "
"explicit export extern false float for friend goto if "
"inline int long mutable namespace new not not_eq "
"operator or or_eq private protected public register "
"reinterpret_cast return short signed sizeof static "
"static_cast struct switch template this throw true "
"try typedef typeid typename union unsigned using "
"virtual void volatile wchar_t while xor xor_eq"
"mov";* // my new keyword*
if (set == 3)
return
"a addindex addtogroup anchor arg attention author b "
"brief bug c class code date def defgroup deprecated "
"dontinclude e em endcode endhtmlonly endif "
"endlatexonly endlink endverbatim enum example "
"exception f$ f[ f] file fn hideinitializer "
"htmlinclude htmlonly if image include ingroup "
"internal invariant interface latexonly li line link "
"mainpage name namespace nosubgrouping note overload "
"p page par param post pre ref relates remarks return "
"retval sa section see showinitializer since skip "
"skipline struct subsection test throw todo typedef "
"union until var verbatim verbinclude version warning "
"weakgroup $ @ \\ & < > # { }";
if (set == 16)
return "mdef mend"; *// my new keywords*
return 0;
}
Please let me know in case I have missed something.
Also I wanted to play with existing colour scheme that lexer is following.
wondering if it is possible.
Any help, link or suggestion will help a lot.
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20120222/7c38abc9/attachment.html>
More information about the QScintilla
mailing list