UDL: operator including ((EOL)) or \r or \n or equivalent

  • Hi, Notepad++ community.

    I was wondering whether there’s a way to include something to represent ‘end of line’ or ‘newline’ or ‘return’ in the Operators field.

    I can define simple operators consisting of one symbol, such as “*”.
    I can also define slightly more complicated operators consisting of a string (with no spaces), such as “mult”.

    But can I define an operator that includes ((EOL)) or \r or \n or an equivalent?
    For instance: “((EOL))”.

    Use case: highlighting line-continuation characters in the code. They happen to be written as backslash. Backslashes appear all through the script, but only the ones at the end of a line get interpreted (by the compiler) as line-continuation flags.
    Possibly this could be done in the code-folding part of the UDL functionality, but I already have something else specified there which has a greater priority.

    Another idea was to combine the ((EOL)) with a delimiter.
    I tried starting or ending the delimiter definition with “((EOL))”, but it doesn’t seem to work. And even if it were recognised I’d probably be forced to highlight at least one unwanted character. E.g. start with “((EOL))” and end with “any character” [whatever the command for that might be].
    Note: I should not start with “” and end with “((EOL))”. Although Notepad++ understands this correctly, it will pick up backslashes anywhere in the text, rather than only those at the end of a line. So it wouldn’t be what I want.


    foo = "The \t backslash \t at the end of this line \
    should be highlighted, and the same with this one.\
      But \t none \t of the others should be.";
    bar = "c:\myfiles\stuff\document.text"
    set literal Don't worry about this last case\    # in which the _apparent_ continuation flag is followed by a comment.


  • @DIV-on-github said in [UDL: operator including ((EOL)) or \r or

    any reason not to use " as a start and end tag in a delimiter and do nesting with comment line?


  • Hello, Ekopalypse. Thanks for putting forward your suggestion.

    However, I think there’s a reason not to use anything involving literal quotation marks, because the script may also include things like the following

    >show /DATA READER/CASE:Case 123_01/BOUNDARY:BC_walls, view=/\
    VIEW:View 2
      Antialiasing = On
      Hardcopy Filename = O:/123/305/\
      White Background = Off
      CASE:Case 123_01
          Colour = 1, 0.5, 0.5
          Draw Faces = On
          Draw Lines = Off
          Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform
          Specular Lighting = On
          Transparency = 0.0
            Apply Translation = Off
            Scale Vector = 1 , 1 , 1

    You can see that there are no (explicit) quotations above.
    [BTW, in case it’s still unclear, this second example contains precisely two backslashes that serve to flag continuation of the line.]

    When I described the backslashes as “line-continuation characters”, I did not intend to imply that they only have that function for quotations. Certainly the first example I gave contained a quotation, but that was merely one instance of what I described in the text.

    Also, it is not my intention to highlight the entire line. (Perhaps you had thought it was? At least, there is no distinct highlighting of the final backslashes in your screenshot.) My intention is to highlight only the line-continuation characters themselves (i.e. the EOL-preceding backslashes).


  • @DIV-on-github

    I don’t think it can be done with builtin functionality as long as you cannot
    ensure that the backslash is not glued to other chars.
    The only other possibility I see is to use a script like this one with a regex like \\(?=\s) .

Log in to reply