• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 324 Views
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
    Antonio Guerriero
    last edited by Mar 27, 2023, 9:44 AM

    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?

    P 1 Reply Last reply Mar 27, 2023, 1:21 PM Reply Quote 0
    • P
      PeterJones @Antonio Guerriero
      last edited by Mar 27, 2023, 1:21 PM

      @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
      1 out of 2
      • First post
        1/2
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors