Community
    • Login

    Escape backslash quotes in string in user defined language

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 6.8k 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.
    • Z Offline
      Zertdubitfo
      last edited by

      Hi all,
      I try to write a user defined language for Groovy (in fact just an improvement of one found on the web).

      Groovy’ strings delimiter can be either ’ (single quote) or " (double).
      You can escape a single quote within a string delimited by single quotes.

      For example, you can have : ‘blah blah' blah blah’.
      My problem is that the escaped quotes ' is always detected as end of the string.
      So the last single quote is interpreted as the start of a new string which imply the highlighting is wrong for the reste of the file.

      Is there any way in a user defined language to exclude ' as string delimiter when ’ is a string delimiter ?

      Thank you in adance for your help

      1 Reply Last reply Reply Quote 1
      • Jan SchreiberJ Offline
        Jan Schreiber
        last edited by

        In the UDL dialog, click the “Operators and Delimiters” tab. Under the caption “Delimiter 1” add the double quotation mark " as both “Open” and “Close”, the backslash as “Escape”. Same for the single quotation mark under “Delimiter 2”.

        1 Reply Last reply Reply Quote 1

        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