Community

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

    UDL Multiple Styles/Colors for Operators

    Help wanted · · · – – – · · ·
    3
    4
    261
    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.
    • Bev
      Bev last edited by

      tldr; Is it possible to have two groups of operators, each one having their own style?

      I’m not a coder, I’m using npp for translating games, there is some code tinkering involved, but I mostly work on normal text. That’s why default Languages don’t really work for me so I’ve decided to define my own.

      I’ve pretty much got everything how I wanted, but I would like to have some symbols highlight with different colors: " ( ) with one, and . , ? ! with the other. Is this possible e.g. through editing UDL file?

      PeterJones Lycan Thrope 2 Replies Last reply Reply Quote 0
      • PeterJones
        PeterJones @Bev last edited by

        @bev ,

        No, UDL only has one style associated with both the Operators1 and Operators2 fields, so all operators will use the same color, if using only the UDL feature set. Sorry.

        But you can add extra highlighting to a User Defined Language (UDL) using regexes via the PythonScript plugin in conjunction with the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo – the comments in the script explain how to install and customize it. If you give it a go, and need help, feel free to show what you’ve got so far, and @Ekopalypse or one of the regulars here will probably be able to nudge you in the right direction.

        1 Reply Last reply Reply Quote 4
        • Lycan Thrope
          Lycan Thrope @Bev last edited by

          @bev
          In addition to what Peter has mentioned, you could get a different color for the parenthesis by using them as delimiters of which there are 8 slots to put them and style them.
          Open: ( ?
          Close: ) !

          Other than that, Peters right that you can’t style the operators 1 or 2 differently than the one style. Good Luck.

          Lee

          1 Reply Last reply Reply Quote 3
          • Bev
            Bev last edited by

            Well, now I feel dumb.

            Somehow I didn’t realised what Nesting is for. Eh.
            I was able to rearrange everything and make it work.

            Thanks for help guys.

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