Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to add Keyword class to cause highlighting

    Help wanted · · · – – – · · ·
    2
    8
    5463
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Stod
      A Stod last edited by

      Hi I am trying to add a few new keywords to Verilog language. I have been studying this thread which has been quite helpful in creating a new Keyword Class “type1” for Verilog and giving it its own set of keywords.

          <Language name="verilog" ext="v sv vh svh" commentLine="//" commentStart="/*" commentEnd="*/">
              <Keywords name="instre1">always and assign attribute begin buf bufif0 bufif1 case casex casez...
              <Keywords name="instre2">SYNTHESIS $assertkill $assertoff $asserton $bits $bitstoreal...
              <Keywords name="type1">test_word1 test_word2</Keywords>
          </Language>
      

      I add this also to the stylers.xml:

          <LexerType name="verilog" desc="Verilog" ext="">
                ...
              <WordsStyle name="SPECIAL WORD" styleID="22" fgColor="A082BD" bgColor="293134" keywordClass="type1"></WordsStyle>
                ...
          </LexerType>
      

      The problem is that even though the style configuration can see the new keyword Class, it does not actually apply any syntax highlighting to any keywords in the new class…

      When I open the Style Configurator, I can see the “SPECIAL WORD” category with the correct color and Default Words come up, but then the words are not actually highlighted in the files with the appropriate extensions (*.v, *.sv, *.vh, etc.). Furthermore adding new user-defined keywords to the SPECIAL WORD category doesn’t cause them to be highlighted either. I have tried changing the styleID a few times…

      Claudia Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        Claudia Frank @A Stod last edited by Claudia Frank

        @A-Stod

        Verilog supports only two keyword lists, which are already used as instre1 and 2

        void setVerilogLexer(){
            setLexer(SCLEX_VERILOG, L_VERILOG, LIST_0 | LIST_1);
        

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • A Stod
          A Stod last edited by

          Oh I see. And it’s not possible to modify this right?

          Claudia Frank 1 Reply Last reply Reply Quote 0
          • Claudia Frank
            Claudia Frank @A Stod last edited by

            @A-Stod

            depends, of course you can change the code and recompile your own version,
            but with the standard npp exe, no, not yet.
            What you can do is opening an enhancement request here and ask for changing it.

            Maybe @dail 's new scintillua plugin might help you in the meantime but I haven’t had a chance to investigate what it can do or can’t.

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 1
            • A Stod
              A Stod last edited by

              Thank you for your help.

              Would you be so kind as to point me to exactly which files need to be edited to add another Keyword Class as well as a URL for a webpage containing the steps of how to recompile my version?

              Claudia Frank 2 Replies Last reply Reply Quote 0
              • Claudia Frank
                Claudia Frank @A Stod last edited by

                @A-Stod

                What needs to be done in regards of compiling npp and scintilla is described here.

                The file in question is ScintillaEditView.h.
                Whether this is the only place which needs to be modified or not I don’t know
                as I haven’t done it myself yet. But when you do have c++ knowledge you should be able to find out.

                Cheers
                Claudia

                1 Reply Last reply Reply Quote 1
                • Claudia Frank
                  Claudia Frank @A Stod last edited by

                  @A-Stod

                  side note, the lexer itself (LexVerilog.cxx) is capable of using 6 keyword groups.

                  class LexerVerilog : public ILexerWithSubStyles {
                      CharacterSet setWord;
                      WordList keywords;
                      WordList keywords2;
                      WordList keywords3;
                      WordList keywords4;
                      WordList keywords5;
                      WordList ppDefinitions;
                  

                  and if you do it yourself it would be nice to let us know what you did,
                  so that the next one could benefit :-)

                  Thx and cheers
                  Claudia

                  1 Reply Last reply Reply Quote 0
                  • A Stod
                    A Stod last edited by

                    I’ll give it a shot. If I am successful, I’ll for sure reply back

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    Copyright © 2014 NodeBB Forums | Contributors