Community

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

    langs.xml: Distinguish between range and 'range (apostrophe!)

    Help wanted · · · – – – · · ·
    2
    3
    75
    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.
    • el-coder-sb
      el-coder-sb last edited by

      This questions refers to #8511.

      Is there a way to make a different coloring for

      range
      

      and

      'range
      

      or any other keyword once with and the other time without apostrophe <'> .

      When I enter the two versions to different keyword types in langs.xml both are colored the same way.

      Any idea how to do to get different coloring?

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @el-coder-sb last edited by

        @el-coder-sb ,

        In my experience, the keywords (whether default or user-defined) for a given language’s styler (lexer) all must be composed of ASCII “word” characters (A-Z, a-z, 0-9, and _ underscore). Some of the lexer’s might manually override that, but I don’t know of any off the top of my head.

        In case that’s not clear: as far as I know, what you want cannot be done natively in Notepad++ without a source-code change.

        However, you can add extra highlighting to a builtin lexer (like the VHDL lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo – since it’s regex based, it should be fairly easy to set up a regex like '(range|length) which would recognize 'range or 'length, and color those separately from the builtin non-apostrophe versions

        (Interesting: in the VHDL definition, the range keyword is in both the INSTRUCTION (name="instre1") and in the ATTRIBUTE (name="type1") lists. The INSTRUCTION formatting takes precedence.)

        1 Reply Last reply Reply Quote 3
        • el-coder-sb
          el-coder-sb last edited by

          @PeterJones Thanks a lot for that very good information!
          I´ll see how to deal with this.

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