Community
    • Login

    User Defined Lanaguage - creating a style for LABEL names ending with colon ':'

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 550 Views 2 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.
    • Antonio GuerrieroA Offline
      Antonio Guerriero
      last edited by

      Hi
      I’m trying to create a User Defined Language,
      However have run into a problem with a style I’m trying to implement.
      the Language has defined LABELS which end in the ‘:’ colon character.
      Much like the Windows Batch files where the label starts with a ‘:’.

      I cannot get npp to implement this either as a comment or anything else I’ve tried.

      Is their any articles out there for this?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Antonio Guerriero
        last edited by

        @Antonio-Guerriero ,

        You just want it to be “any token that ends in a : should be considered a LABEL”? Yeah, the User Defined Language lexer isn’t designed to be that complicated: it is intended for a specific list of keywords

        The EnhanceAnyLexer plugin will allow you to add a regex to change the foreground of matching text on a per language (per UDL, or per builtin lexer). Assuming that the LABEL has to be the first non-whitespace sequence on a line, and must be only alphanumeric-and-underscore-before-:, then the following should make your LABEL green.

        [your_udl_name_here]
        0x00CC00 = ^\h*\w+:
        
        1 Reply Last reply Reply Quote 2

        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