Community
    • Login

    User-Defined Language | Block comments

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    comment linecomment stylecommentssyntax highlightcomment block
    10 Posts 4 Posters 9.2k 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.
    • ePostlerE
      ePostler
      last edited by

      Dear all,
      I created a user-defined language using the GUI (Language --> Define your language…) in Notepad++ v6.9.2 on Windows.
      The syntax highlighting is working perfectly, except for comment stlye (block comments). My comment settings are:

      • Line comment position: Allow anywhere
      • Allow folding of comments: <checkmark set>
      • Comment line style:
        - Styler: <all empty/no settings>
        - Open: $
        - Continue character: <empty>
        - Close: <empty>
      • Comment style:
        - Styler: <all empty/no settings>
        - Open: $$
        - Close: $$

      Just to clarify:
      Opening of a comment line must be done with a $.
      Opening and closing of a block comment must be done using a $$, as I do not have any influence on the language itself.

      Thank you for helping!
      ePostler

      ePostlerE 1 Reply Last reply Reply Quote 0
      • ePostlerE
        ePostler @ePostler
        last edited by

        @ePostler said:

        Dear all,
        I created a user-defined language using the GUI (Language --> Define your language…) in Notepad++ v6.9.2 on Windows.
        The syntax highlighting is working perfectly, except for comment stlye (block comments). My comment settings are:

        • Line comment position: Allow anywhere
        • Allow folding of comments: <checkmark set>
        • Comment line style:
          - Styler: <all empty/no settings>
          - Open: $
          - Continue character: <empty>
          - Close: <empty>
        • Comment style:
          - Styler: <all empty/no settings>
          - Open: $$
          - Close: $$

        Just to clarify:
        Opening of a comment line must be done with a $.
        Opening and closing of a block comment must be done using a $$, as I do not have any influence on the language itself.

        Thank you for helping!
        ePostler

        Sorry, but my message was not previewed correctly on the right side!
        Block comments use two dollar signs for opening and closing!!
        So like this $ $ , but without any space inbetween!
        Cheers, ePostler

        Claudia FrankC 1 Reply Last reply Reply Quote 0
        • Jim DaileyJ
          Jim Dailey
          last edited by Jim Dailey

          @ePostler
          Instead of the Comment & Number tab, have you tried to use the Operators & Delimiters tab to highlight block comments? I use it to have various flavors of comments by defining different Delimiter styles for each.

          The delimiters seem to work pretty well for all kinds of “block” highlighting.

          1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @ePostler
            last edited by

            @ePostler

            and in addition,what I discovered recently, when using delimiters and one is a subsets of the other
            define the subset later. E.g.

            Delimiter1
            Open:$$
            Close:$$

            Delimiter2
            Open:$
            Close:((EOL))

            Cheers
            Claudia

            1 Reply Last reply Reply Quote 1
            • Claudia FrankC
              Claudia Frank
              last edited by Claudia Frank

              fail into the same trap - first delimiter is of course two dollar signs.

              Delimiter1
              Open:$$
              Close:$$

              Delimiter2
              Open:$
              Close:((EOL))

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 1
              • ePostlerE
                ePostler
                last edited by

                Thank you for your response! I solved my problem with Claudia Frank’s suggestion!

                1 Reply Last reply Reply Quote 0
                • ePostlerE
                  ePostler
                  last edited by ePostler

                  Is it possible to define a single space in a delimiter?
                  I am thinking on defining Delimiter Open as $ followed by a single space. Using regular expressions, I would like to use something like $\s
                  The background to this is that in the language, which I use, the $ is used (too) extensively :) It is used for comments ($), block comments ($$), and for modifying some expressions ($). For the latter, no space is allowed. This led to the idea of defining the normal comment as $\s.
                  I thought looked up regular expressions, but could not find a solution yet.
                  Reading trough the UDL 2.0 doc gave me the idea that a space may cannot be defined.
                  However, I hope someone of you has got a solution or at least a hint for me :)

                  Claudia FrankC 1 Reply Last reply Reply Quote 0
                  • Claudia FrankC
                    Claudia Frank @ePostler
                    last edited by Claudia Frank

                    @ePostler

                    afaik no, you cannot define a space to be significant.
                    If I understand correctly, your dollar sign is used like this

                    $expression
                    
                    $ line comment
                    
                    $$block
                    comment
                    comment
                    comment
                    $$
                    
                    $another_expression
                    

                    If this is the case than you can define
                    delimiter 1 two dollar signs open and close
                    delimiter 3 one dollar sign + a to one dollar sign + z using the same
                    color as the expression or default and the same amount of ((EOL)) for closing
                    So e.g. $a $b $c $d $e $f … $z
                    Together with ((EOL)) ((EOL)) ((EOL)) ((EOL)) ((EOL)) … ((EOL))
                    delimiter 5 one dolar sign for open and ((EOL)) for close.

                    Btw. the new udl documentation link is http://ivan-radic.github.io/udl-documentation/

                    Cheers
                    Claudia

                    P.S. I don’t know if this can be solution for but I’m working on a python script
                    based lexer which uses regular expressions exclusively. If you are interested let me know.
                    I assume that it might take another 2-4 weeks before it can go public.

                    1 Reply Last reply Reply Quote 0
                    • audio scavengerA
                      audio scavenger
                      last edited by

                      we have the same problem and “Operators & Delimiters” is not a good alternative
                      this will highlight as comment all the text that starts with a dash even in the middle of a line which is not what we (and this poster) want

                      i installed various older versions of np++ portable and this bug happens between version 6.6.6 and 6.7.9

                      1 Reply Last reply Reply Quote 0
                      • audio scavengerA
                        audio scavenger
                        last edited by

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