Skip to content

moon6969/NPP-lexer-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notepad++ plugin with crude external lexer.

Minimal changes to standard C++ Notepad++ plugin template to figure out how to implement an external lexer.

Neither Scintilla or NPP provide much documentation on how to create a lexer - let alone an external one!

For the actual lexing part I suggest looking at the built in NPP lexers source.

Disclaimer

My C++ is... crusty.

Notes

LexerTemplate.vcxproj file sets <PlatformToolset> = v142 for Visual Studio 2019.

Interface functions required for NPP to use the lexer are declared with... extern "C" __declspec(dllexport) ... __stdcall but still needed an exports.def file to work (I assume something to do with name mangling).

src\scintilla is unmodified header files copied from NPP\Scintilla\include

src\lexlib contains required files copied from NPP\Scintilla\lexlib - unchanged other than commenting out some headers that were not required.

src\Lexer\Config\LexerTemplate.xml defines the language keywords & styles. See NPPs lang.xml and stylers.xml for inspiration.

Install

Copy the plugin dll to plugins\LexerTemplate\LexerTemplate.dll and the xml file to plugins\Config\LexerTemplate.xml "LexerTemplate" should appear: In Language menu...

Language Menu

At the bottom of Settings -> Style Configuration... Style Configuration Menu

About

Example of external lexer plugin for Notepad++

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 50.9%
  • C 49.1%