[QScintilla] Custom Lexer based on QscilexerCPP

Phil Thompson phil at riverbankcomputing.com
Sat Jul 12 10:01:27 BST 2014


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


More information about the QScintilla mailing list