Extending the CPP Lexer

  • elsanders

    elsanders - 2012-11-13


    I've been trying to edit the Scintilla CPP Lexer used by Notepad++ to add a new keyword group for styling.
    The idea was to apply a new color to a customized set of words. The files modified in my attempts to achieve this were:

    LexCPP.cxx - To handle the new keyword list.
    SciLexer.h and Scintilla.iface - For the #define that will be used later as the "styleID".

    SciLexer.dll was recompiled after those changes were made.
    Then I changed two more files:

    %APPDATA%/Notepad++/stylers.xml - A new entry was created for my new keyword group using the previously created #define number as the "styleID" and "type3" as the "keywordClass".
    %APPDATA%/Notepad++/langs.xml - I defined "type3" as a keyword name for CPP and added my custom keywords here.

    When I decided to test this out, the new words were not being colored at all.
    After running a few more tests to find out what was happening, I noticed that my keyword group was not being sent to the function in LexCpp.cxx that would store them in the WordLists.
    Only the default keywords (the ones in "instre1", "type1" and "type2") were stored in their respective 'WordLists'.

    Is it needed to change another file besides the ones I mentioned above?
    I can post the parts I modified in the source code if it helps.

    Thanks in advance!

  • Loreia2

    Loreia2 - 2012-11-15


    CPP lexer is set by this function:

    void ScintillaEditView::setCppLexer(LangType langType)

    Try to put a break point in there and see what is going on.
    Alternative is to try to do the same thing with new UDL2 module.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks