Community
    • Login

    UDL doesn't work as wanted

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 265 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.
    • Juergen MoorsJ
      Juergen Moors
      last edited by

      Hi all,

      I created a User Defined Language for analyzing logfiles. In the “Keyword Lists” I created a Styler containing “-140”, “(-140)” and “<-140>”:
      Screen Shot 09-23-20 at 04.52 PM 001.JPG
      But for the analysis, not all “-140” are matched:
      Screen Shot 09-23-20 at 04.51 PM.JPG
      A few lines later there is no highlighting of “-140”:
      Screen Shot 09-23-20 at 04.52 PM.JPG

      Does someone have an idea what I did wrong?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Juergen Moors
        last edited by PeterJones

        @Juergen-Moors

        That’s because '<-140>' is not the same sequence as <-140>, so it doesn’t match. The lexer uses full tokens, and if you merge things together without spaces, it will treat them differently than if there are spaces between.

        If you go to the Delimiters tab, and add ' as the Delimiter # style (# of your choice), then go into that entry’s styler, and enable nesting, then it will be able to recognize things inside the ' marks as something to process, too

        No nesting:
        3de55f15-f2fa-4c2c-9fa4-ea21d36425af-image.png

        With nesting:
        dc026706-67cd-44b0-85b2-a0f1b46410da-image.png

        Or, without setting the single quotes as delimiters, if you had spaces between the ' and the (-140), so that the parser would treat (-140) as a separate token, it would recognize it as well:
        7bc56932-a70e-4cf7-9a98-44e03a5ccbde-image.png

        In my example, I changed the styling of the ' delimiter to make it obvious, but if you don’t want the ' portion highlighted in any way, don’t set any of the styles, but just set the nesting. Remember to nest anything that might end up inside those pairs.

        BTW: you’ll notice that -140 on its own doesn’t get highlighted either. That’s because the UDL lexer recognizes it as a number, and thus highlights it as a number rather than as a keyword.

        Juergen MoorsJ 1 Reply Last reply Reply Quote 1
        • Juergen MoorsJ
          Juergen Moors @PeterJones
          last edited by

          @PeterJones said in UDL doesn't work as wanted:

          Delimiter

          Thank you very much Peter! That helps:

          Screen Shot 09-24-20 at 09.40 AM.JPG

          Screen Shot 09-24-20 at 09.41 AM.JPG

          With these settings, the matches are correct shown in the whole logfile!
          Screen Shot 09-24-20 at 09.41 AM 001.JPG

          Screen Shot 09-24-20 at 09.41 AM 002.JPG

          Kind regards,
          Juergen

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors