Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 509 Views 1 Watching
    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-sbE Offline
      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?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        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-sbE Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors