Menu

New External Lexer Support Template/Tutorial

Garthex
2008-01-06
2012-11-14
  • Garthex

    Garthex - 2008-01-06

    Hello developers!
    Having been disappointed with the User Defined Languages and noticing the capabilities of Scintilla, I decided to implement external lexer support through plugins in Notepad++ (which is active in N++ 4.7.1 and higher). As such, I felt it would be helpful for you to have a template to base your plugins on. (Most of the template is borrowed from other code within Notepad++ and Scintilla) I've documented the significant points of it.
    http://rapidshare.com/files/81831321/MyLexerTemplate.zip

    Also, here is the lexer I wrote for Garry's Mod 10 which uses Lua 5.1 (as of the upcoming Gmod patch) with C++ mixed in.
    http://rapidshare.com/files/81831283/GmodLua.zip

    I order to compile either, first download and compile Notepad++ using Microsoft Visual Studios 8. Then unzip either folder into the npp.4.6.src directory so that the folder is sitting alongside the PowerEditor and scintilla folders. Use Visual Studios to compile the plugin. Then look in the plugin's bin folder and take the dll and the Config folder and drop it in Notepad++'s plugins folder. Enjoy!

    Any questions? feel free to ask.

    -Garthex

     
    • Garthex

      Garthex - 2008-01-06

      I added copyright information. Both are licensed under the GPL.
      http://rapidshare.com/files/81837481/MyLexerTemplate.zip
      http://rapidshare.com/files/81837444/GmodLua.zip

      Also, in case you were wondering what an external lexer is, it allows you to use lexers exactly how they are in Scintilla, but through a plugin. This enables you to have modified languages and be able to update Notepad++ and Scintilla each update without recompiling yourself to include your language.

      -Garthex

       
    • Garthex

      Garthex - 2008-01-07

      Oops seems some of the files had been updated to an earlier version. Here's the correct copy.
      http://rapidshare.com/files/81856871/MyLexerTemplate.zip
      http://rapidshare.com/files/81856835/GmodLuaSrc.zip

      -Garthex

       
    • Garthex

      Garthex - 2008-01-07

      There needs to be an edit button for people like me... Minor bug.
      http://rapidshare.com/files/81858422/GmodLuaSrc.zip

      -Garthex

       
    • steakhacher

      steakhacher - 2008-01-08

      Is it possible that you include the compiled dll in your zip file for those who have not visual on there computer.

      Thanks

       
    • Garthex

      Garthex - 2008-01-08

      Sure.
      http://rapidshare.com/files/82308990/NppGmodLuaPlugin.zip
      http://rapidshare.com/files/82310449/LexerTemplateDLL.zip

      The template won't actually change any of the highlighting because it's just a shell, but the Gmod Lua one works. (Though I haven't finished it.)

      -Garthex

       
    • Garthex

      Garthex - 2008-01-12

      I've removed the GmodLua files, since I made some major changes. To find the latest version of Garry's Mod Lua Lexer, visit http://forums.facepunchstudios.com/showthread.php?t=477505
      The LexerTemplate will stay on rapidshare until they are uploaded to sourceforge (whenever that happens)

      If you have any further questions, feel free to message me.

      -Garthex

       
    • Nobody/Anonymous

      Does this lexer support folding?

       
    • Nobody/Anonymous

      Add any of these Keywords entries to the Languages group/tag:

                  <Keywords name="Delimiters">[00]00</Keywords>
                  <Keywords name="Folder+">Begin FolderOpenKeywords</Keywords>
                  <Keywords name="Folder-">End FolderCloseKeywords</Keywords>
                  <Keywords name="Operators"># ( ) { } &lt; = &gt;</Keywords>
                  <Keywords name="Comment">1 2 0[</Keywords>

      ... or something likt it.

      Just look in the stylers.xml for the default languages to get a clue.

       
    • Garthex

      Garthex - 2008-03-04

      Yes the lexer supports folding, the same way as other built-in languages (not user defined). The folding is implemented in C++ and not by defining any keywords (the keywords are for user defined languages).

       
    • Garthex

      Garthex - 2008-04-11

      I fixed the LexerTemplate to reference the headers in the Notepad++ source instead of supplying its own. Here is the new version:

      http://rapidshare.com/files/106730426/MyLexerTemplate.zip
      http://rapidshare.com/files/106730398/LexerTemplateDLL.zip

       
    • cchris

      cchris - 2009-05-10

      The links in the initial post are broken. Any updates available?

      CChris

       
      • Thell Fowler

        Thell Fowler - 2009-05-12

        Chris,

        garthex has changed over the npp_gmod_lua external lexer to the Notepad++ External Lexers plugin template ( https://sourceforge.net/forum/message.php?msg_id=6360852 ) yet I did not hear word if his template/tutorial had also switched.

        The NppExtLexer plugin does include a template, tutorial for new, copied, and converted user language, and a few samples.

        almostautomated

        https://sourceforge.net/forum/message.php?msg_id=6360852