• Login
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.
  • E
    ePostler
    last edited by Aug 22, 2016, 3:43 PM

    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

    E 1 Reply Last reply Aug 22, 2016, 4:03 PM Reply Quote 0
    • E
      ePostler @ePostler
      last edited by Aug 22, 2016, 4:03 PM

      @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

      C 1 Reply Last reply Aug 24, 2016, 12:32 AM Reply Quote 0
      • J
        Jim Dailey
        last edited by Jim Dailey Aug 23, 2016, 2:52 PM Aug 23, 2016, 2:52 PM

        @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
        • C
          Claudia Frank @ePostler
          last edited by Aug 24, 2016, 12:32 AM

          @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
          • C
            Claudia Frank
            last edited by Claudia Frank Aug 24, 2016, 11:03 PM Aug 24, 2016, 11:02 PM

            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
            • E
              ePostler
              last edited by Aug 26, 2016, 12:11 PM

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

              1 Reply Last reply Reply Quote 0
              • E
                ePostler
                last edited by ePostler Feb 9, 2017, 10:19 AM Feb 9, 2017, 10:16 AM

                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 :)

                C 1 Reply Last reply Feb 9, 2017, 9:43 PM Reply Quote 0
                • C
                  Claudia Frank @ePostler
                  last edited by Claudia Frank Feb 9, 2017, 9:46 PM Feb 9, 2017, 9:43 PM

                  @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
                  • A
                    audio scavenger
                    last edited by May 13, 2020, 9:20 PM

                    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
                    • A
                      audio scavenger
                      last edited by May 13, 2020, 9:40 PM

                      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