Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    User-Defined Language | Block comments

    Help wanted · · · – – – · · ·
    comment line comment style comments syntax highligh comment block
    4
    10
    8266
    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.
    • ePostler
      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

      ePostler 1 Reply Last reply Reply Quote 0
      • ePostler
        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 Frank 1 Reply Last reply Reply Quote 0
        • Jim Dailey
          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 Frank
            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 Frank
              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
              • ePostler
                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
                • ePostler
                  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 Frank 1 Reply Last reply Reply Quote 0
                  • Claudia Frank
                    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 scavenger
                      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 scavenger
                        audio scavenger last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright © 2014 NodeBB Forums | Contributors