Adding a new lexer for use with Notepad++

776 views
Skip to first unread message

Keith Smith

unread,
Aug 16, 2013, 10:15:30 PM8/16/13
to scintilla...@googlegroups.com
Hello. Hope I have the right group. I have been using Notepad++ for what seems like forever. I have dabbled with creating my own user defined languages, but that mechanism is always a bit short on features.

I want to add my own languages to Notepad++. It seems I need to start with Scintilla.

I have downloaded the source for Notepad++, which is PowerEditor and Scintilla. Looking through the code I find that all the lexers for Notepad++ come from Scintilla.

I have looked at the files SciLexer.h and Scintilla.iface. Scintilla.iface seems to be part of the key to adding a new lexer to Scintilla and thus Notepad++.

Is there a 'how to on what needs to be 'touched' to add a lexer to scintilla and then to NotePad++? and how to define a lexer?

Thank you for your help.

Keith Smith
Fairfield, CT

Neil Hodgson

unread,
Aug 16, 2013, 10:38:07 PM8/16/13
to scintilla...@googlegroups.com
Keith Smith:

> Is there a 'how to on what needs to be 'touched' to add a lexer to scintilla and then to NotePad++? and how to define a lexer?

The basics are in http://www.scintilla.org/Lexer.txt

Neil

Keith Smith

unread,
Aug 16, 2013, 11:48:57 PM8/16/13
to scintilla...@googlegroups.com, nyama...@me.com
Neil -

Yes Lexer.txt is the basics. I have looked at some examples, such as lexers/LexForth.cxx or lexers/LexAsm.cxx. They are examples of what is discussed in Lexer.txt.

The examples appear to be similar to how one adds a test to Google UnitTest. One writes the code, then writes a declaration interface to get the test included.

LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc);

So one writes the details in a new LexXXX.cxx file and creates the last line declaring LexerModule making the appropriate 3 letter substitutions.

Did I miss anything?

What I am now wondering about is include/Scintilla.iface? Do I need to do anything with this file?

Keith

Neil Hodgson

unread,
Aug 17, 2013, 6:40:57 PM8/17/13
to scintilla...@googlegroups.com
Keith Smith:

What I am now wondering about is include/Scintilla.iface? Do I need to do anything with this file?

   You should enumerate all the lexical classes (styles) defined by your language.

   Neil

Reply all
Reply to author
Forward
0 new messages