• Login
Community
  • Login

regex in functionList/php.xml to display a specific comment in functionlist

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 366 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.
  • T
    Tom_1978
    last edited by Dec 24, 2024, 12:21 PM

    Hello.

    I have been using version 7.8.4 so far.

    For better clarity in long procedural PHP source code, I have made a small additionn. All lines of code that begin with “###mainblock:” are displayed like a function in the function list on a right area.

    I have extended the functionList.xml under functionList > parser > function as follows:

    <function mainExpr="^\s*(function|###mainblock:)\s+[\.\w]+\s*\(">
    

    Unfortunately, this no longer works in version 8.7.4. The RegEx for source code parsing has been greatly expanded there. There I have the file functionlist/php.xml.

    If I extend the MainExpression there under functionList > parser > function accordingly:

    (?-i:function|###mainblock:)\s+
    

    But it does not work. It is not displayed as an entry in the function list. I suspect it is because of the # , which is why the whole line is treated as a comment. But this is necessary, because it is only comment. After 4 hours of trial and error, I have to give up and hope for a little help from you. please

    What I have to do so that in version 8.7.4 a line like ###mainblock(‘my_title’) {} is displayed in the function list?

    P 1 Reply Last reply Dec 24, 2024, 3:12 PM Reply Quote 1
    • P
      PeterJones @Tom_1978
      last edited by PeterJones Dec 24, 2024, 3:14 PM Dec 24, 2024, 3:12 PM

      @Tom_1978 said in regex in functionList/php.xml to display a specific comment in functionlist:

      I have been using version 7.8.4 so far.

      If that’s not a typo, then that was pretty old. And the FunctionList definitions changed around v7.9. The user manual has a section on updating old definitions to the “new” style. If you want a definition from pre-7.9 to work in modern v8.7.4, you’ll have to follow those instructions.

      T 1 Reply Last reply Dec 24, 2024, 8:41 PM Reply Quote 3
      • P PeterJones referenced this topic on Dec 24, 2024, 3:17 PM
      • T
        Tom_1978 @PeterJones
        last edited by Dec 24, 2024, 8:41 PM

        @PeterJones Yes, I know. My old Notepad++Version was already very old. That’s why I updated it. I have also seen and read the documentation. Unfortunately, I’m not experienced with regex and spent 6 hours today trying it out in vain. I was hoping that you could help me. I’m sure it’s just a small thing.

        I just want a specific keyword from a comment line to cause that comment line to be included in the function list on the right side of the Notpad++.

        I would be very happy if someone could help me.

        M 1 Reply Last reply Dec 24, 2024, 11:34 PM Reply Quote 0
        • M
          mpheath @Tom_1978
          last edited by Dec 24, 2024, 11:34 PM

          @Tom_1978 This changeset in the year 2020 modified commentExpr to include single line comments that start with #.

          Line 19 in php.xml sets # and // as comment zones not valid for matching. Changing or removing that line may help to get back the v8.7.4 behavior though their might be some side effects as the other patterns have changed so much.

          T 1 Reply Last reply Dec 25, 2024, 1:37 PM Reply Quote 4
          • T
            Tom_1978 @mpheath
            last edited by Tom_1978 Dec 25, 2024, 1:38 PM Dec 25, 2024, 1:37 PM

            @mpheath Your are a legend! Thanks. It works. :-)
            Unfortunately, my reputation is too low. That’s why I’m not allowed to give your post a positive vote.

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