[QScintilla] Custom Lexer based on QscilexerCPP

Steve Lamperti steve2lamperti at gmail.com
Mon Jul 14 19:24:27 BST 2014


Phil,

Thanks for the response.  I started to look into going down that path, 
and quickly found myself feeling like after I make a copy of lexCPP with 
a new name, I need to rebuild QScintilla with that new file it it, and 
then add new constants to several of the other files in QScintilla, 
(SCLEX_XXX, SCLEX_XXNOCASE), and make other modifications as well.  This 
starts feeling like I may be doing more then I need to to do this.
If there is a way you could point me toward some doc that talks about 
this?  Or perhaps if there is no specific doc, maybe you could create a 
short list with points like  1) Copy LexCPP.cpp, 2) Add SCLEX_XXX 
contstants, 3) whatever I should be thinking about next.

The implication of your 'the first thing to do is copy LexCPP.cpp is 
that there are second, third, and more things, and maybe a quick list of 
those things might be enough to get me up and running.

One thing I tried doing was removing the other lexers, as I don't think 
I need them, but please let me know if this is unnecessary.

Thanks for your help,

-Steve


On 7/12/14, 2:01 AM, Phil Thompson wrote:
> On 11/07/2014 11:49 pm, Steve Lamperti wrote:
>> Hi,
>>
>> I'm trying to build a custom lexer that is very closely based on the
>> QSciLexerCPP class.  I started by thinking that I could just make a
>> descendent of that class, and override methods in it to add my desired
>> behaviors/keywords/etc.  But when I tried to do this, I quickly
>> realized that the desired methods that I wanted to override were not
>> virtual.  (For example, I wanted to add a new style, and tried to
>> override DefaultColor to give it a default.)
>>
>> The syntax is really very close to QSciLexerCPP with just a few
>> changes.  If someone could let me know what the recommended method to
>> do this would be, I would appreciate it.  (One option that occurs to
>> me, is just to copy the entire code of the QSciLeverCpp object, and
>> perhaps this would be OK, but if I am missing something, I would
>> appreciate hearing about it.)
>
> The QsciLexer classes are only containers for the configuration of the 
> underlying Scintilla lexers. If you want a new lexer similar to the 
> CPP lexer then the first thing to do is copy LexCPP.cpp.
>
> Phil
> _______________________________________________
> QScintilla mailing list
> QScintilla at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/qscintilla



More information about the QScintilla mailing list