• Login
Community
  • Login

PHP function list and abstract functions

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
19 Posts 3 Posters 8.3k 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.
  • F
    Florent Pagès
    last edited by Jan 20, 2018, 2:08 PM

    Hi, abstract functions are not shown in the function list. You can test the example :

    <?php 
    abstract class Aaaa {
       function foo() { 	    return "azerzaeraz";   	}
       abstract function boo();
       abstract function kopo(); 	
    }
    ?>
    

    I suggest the following change into the functionList.xml

    		<!-- ========================================================= [ PHP ] -->
    		<!-- PHP - Personal Home Page / PHP Hypertext Preprocessor             -->
    
    		<parser
    			id         ="php_syntax"
    			displayName="PHP"
    			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    		>
    			<classRange
    				mainExpr    ="^\s*(class|abstract\s+class|final\s+class|interface|trait)[\t\x20]+[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*(\s*|\s*(extends|implements|(extends\s+(\\|[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)+\s+implements))\s+(\,\s*|(\\|[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*))+\s*)?\{"
    				openSymbole ="\{"
    				closeSymbole="\}"
    			>
    				<className>
    					<nameExpr expr="(class|abstract\s+class|final\s+class|interface|trait)\s+\w+" />
    					<nameExpr expr="\s+\w+\Z" />
    					<nameExpr expr="\w+\Z" />
    				</className>
    				<function
    					mainExpr="^\s*((static|public|protected|private|final|abstract)*(\s+(static|public|protected|private|final|abstract))+\s+)?(function\s+)(\w+(\s+\w+)?(\s+|\*\s+|\s+\*|\s+\*\s+))?(\w+\s*::)?(?!(if|while|for|switch))[\w~]+\s*\([^\{;]*[\{;]"
    				>
    					<functionName>
    						<funcNameExpr expr="(?!(if|while|for|switch))\w+\s*\([^\{]*" />
    						<!-- comment out the following node to display the method with parameters -->
    						<funcNameExpr expr="(?!(if|while|for|switch))\w+" />
    					</functionName>
    				</function>
    			</classRange>
    			<function
    				mainExpr="^\s*function\s+\w+\("
    			>
    				<functionName>
    					<nameExpr expr="(?!(if|while|for))\w+\s*\(" />
    					<nameExpr expr="(?!(if|while|for))\w+" />
    				</functionName>
    				<className>
    					<nameExpr expr="\w+(?=\s*::)" />
    				</className>
    			</function>
    		</parser>
    
    1 Reply Last reply Reply Quote 0
    • C
      chcg
      last edited by Jan 20, 2018, 3:54 PM

      @MAPJe71 A task for you?

      F 1 Reply Last reply Jan 20, 2018, 4:30 PM Reply Quote 0
      • F
        Florent Pagès
        last edited by Jan 20, 2018, 4:17 PM

        An another problem, is the heredoc in php. In some case, a class can not appear in the treeview.

        An example of faulty heredoc :

        function SocialTwitterPlugin() {
        
        return <<<XXCC
        <a href="https://twitter.com/share" class="twitter-share-button" data-via="TutoInformatik" data-
        size="large">Tweet</a> 
        <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)
        [0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id))
        {js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}
        (document, 'script', 'twitter-wjs');</script>	
        XXCC;
        }
        

        perhaps heredoc could be handle like comment ?

        1 Reply Last reply Reply Quote 0
        • F
          Florent Pagès @chcg
          last edited by Jan 20, 2018, 4:30 PM

          @chcg said:

          @MAPJe71 A task for you?

          Why not !

          1 Reply Last reply Reply Quote 0
          • C
            chcg
            last edited by Jan 20, 2018, 4:38 PM

            See https://github.com/notepad-plus-plus/notepad-plus-plus/pull/3393, @MAPJe71 has a expertise for functionlist changes.

            1 Reply Last reply Reply Quote 0
            • F
              Florent Pagès
              last edited by Jan 20, 2018, 8:02 PM

              For the problem with heredoc in php

              		<parser
              			id         ="php_syntax"
              			displayName="PHP"
              			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
              		>
              

              I have changed it into

              		<parser
              			id         ="php_syntax"
              			displayName="PHP"
              			commentExpr="\x3C{3}[\x20\t]*(\w+)(\r|\n|\r\n)(.|[\s])*?\1;(\r|\n|\r\n)|(?s:/\*.*?\*/)|(?m-s://.*?$)"
              		>
              

              seems to work.

              M 1 Reply Last reply Jan 20, 2018, 8:37 PM Reply Quote 0
              • M
                MAPJe71 @Florent Pagès
                last edited by Jan 20, 2018, 8:37 PM

                @Florent-Pagès could you try this:

                				commentExpr="(?x)                                               # free-spacing (see `RegEx - Pattern Modifiers`)
                								(?s:\x2F\x2A.*?\x2A\x2F)                        # Multi Line Comment
                							|	(?m-s:(?:\x23|\x2F{2}).*$)                      # Single Line Comment 1 and 2
                							|	(?s:\x22(?:[^\x22\x24\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                							|	(?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27)             # String Literal - Single Quoted
                							|	(?:                                             # Here Document
                									\x3C{3}(?'HDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)[^\r\n]*(?:\r?\n|\n?\r)
                									(?s:.*?)
                									(?:\r?\n|\n?\r)\k'HDID'                     # close with exactly the same identifier, in the first column
                								)
                							|	(?:                                             # Now Document
                									\x3C{3}\x27(?'NDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)\x27[^\r\n]*(?:\r?\n|\n?\r)
                									(?s:.*?)
                									(?:\r?\n|\n?\r)\k'NDID'                     # close with exactly the same identifier, in the first column
                								)
                							"
                
                1 Reply Last reply Reply Quote 0
                • F
                  Florent Pagès
                  last edited by Jan 21, 2018, 8:53 AM

                  Seems to work. I will test longer this week.

                  1 Reply Last reply Reply Quote 0
                  • F
                    Florent Pagès
                    last edited by Jan 23, 2018, 12:03 PM

                    I have found a bad case but not with heredoc, the class does not appear in functionlist :

                    <?php
                     class Bad  {
                    function RsdTitle() { 
                    	$i = 1;
                    	$table = 5;
                    	if (TRUE) {
                    		switch ($i) {
                    			case 1: return "Jeu pour apprendre la table de multiplication par {$table}";
                    			case 2: return "Jeu pour apprendre la table de {$table} d'addition";
                    		}
                    	}
                    	return "Jeu avec les tables de multiplications https://motsbleus.pages-informatique.com/jeu-tables-multiplications.html"; 	
                    }	
                     } 
                    ?>
                    
                    1 Reply Last reply Reply Quote 0
                    • F
                      Florent Pagès
                      last edited by Jan 25, 2018, 3:16 PM

                      Where to find the regex reference manual used in the functionlist?

                      M 1 Reply Last reply Feb 2, 2018, 6:12 PM Reply Quote 0
                      • M
                        MAPJe71 @Florent Pagès
                        last edited by Feb 2, 2018, 6:12 PM

                        @Florent-Pagès Please try this parser:

                        			<parser
                        				displayName="PHP - Personal Home Page / PHP Hypertext Preprocessor"
                        				id         ="php_syntax"
                        				commentExpr="(?x)                                               # free-spacing (see `RegEx - Pattern Modifiers`)
                        								(?s:\x2F\x2A.*?\x2A\x2F)                        # Multi Line Comment
                        							|	(?m-s:(?:\x23|\x2F{2}).*$)                      # Single Line Comment 1 and 2
                        							|	(?s:\x22(?:[^\x22\x24\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                        							|	(?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27)             # String Literal - Single Quoted
                        							|	(?:                                             # Here Document
                        									\x3C{3}(?'HDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)[^\r\n]*(?:\r?\n|\n?\r)
                        									(?s:.*?)
                        									(?:\r?\n|\n?\r)\k'HDID'                     # close with exactly the same identifier, in the first column
                        								)
                        							|	(?:                                             # Now Document
                        									\x3C{3}\x27(?'NDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)\x27[^\r\n]*(?:\r?\n|\n?\r)
                        									(?s:.*?)
                        									(?:\r?\n|\n?\r)\k'NDID'                     # close with exactly the same identifier, in the first column
                        								)
                        							"
                        			>
                        				<classRange
                        					mainExpr    ="(?x)                                          # free-spacing (see `RegEx - Pattern Modifiers`)
                        							(?(DEFINE)                                          # definition of sub-routines
                        								(?'VALID_ID'
                        									\b(?!(?-i:                                  # keywords (case-sensitive), not to be used as identifier
                        										a(?:bstract|nd|rray|s)
                        									|	b(?:ool|reak)
                        									|	c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                        									|	d(?:e(?:clare|fault)|ie|o)
                        									|	e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                        									|	f(?:alse|loat|inal|or(?:each)?|unction)
                        									|	g(?:lobal|oto)
                        									|	i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                        									|	list
                        									|	mixed
                        									|	n(?:amespace|ew|u(?:ll|meric))
                        									|	o(?:r|bject)
                        									|	p(?:r(?:i(?:nt|vate)|otected)|ublic)
                        									|	re(?:quire(?:_once)?|turn)
                        									|	s(?:t(?:atic|ring)|witch)
                        									|	t(?:hrow|r(?:ait|ue|y))
                        									|	u(?:nset|se)
                        									|	var
                        									|	while
                        									|	xor
                        									|	__(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                        									)\b)
                        									[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*            # valid character combination for identifiers
                        								)
                        								(?'INTERFACE_LIST'
                        									\s+(?:\x5C|(?&amp;VALID_ID))+
                        									(?:
                        										\s*,
                        										\s*(?:\x5C|(?&amp;VALID_ID))+
                        									)*
                        								)
                        							)
                        							(?m-i)                                              # ^ and $ match at line-breaks, case-sensitive
                        							^\h*                                                # optional leading white-space at start-of-line
                        							(?:
                        								(?:(?-i:abstract|final)\s+)?                    # optional class entry type
                        								(?-i:class)\s+
                        								\K                                              # discard text matched so far
                        								(?&amp;VALID_ID)                                # identifier used as class name
                        								(?:                                             # optional extends-from-class
                        									\s+(?-i:extends)
                        									\s+(?:\x5C|(?&amp;VALID_ID))+
                        								)?
                        								(?:                                             # optional implements-class/interfaces
                        									\s+(?-i:implements)
                        									(?&amp;INTERFACE_LIST)
                        								)?
                        							|
                        								(?-i:interface)\s+
                        								\K                                              # discard text matched so far
                        								(?&amp;VALID_ID)                                # identifier used as interface name
                        								(?:                                             # optional extends-from list
                        									\s+(?-i:extends)
                        									(?&amp;INTERFACE_LIST)
                        								)?
                        							|
                        								(?-i:trait)\s+
                        								\K                                              # discard text matched so far
                        								(?&amp;VALID_ID)                                # identifier used as trait name
                        							)
                        							\s*\{
                        						"
                        					openSymbole ="\{"
                        					closeSymbole="\}"
                        				>
                        					<className>
                        						<nameExpr expr="[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
                        					</className>
                        					<function
                        						mainExpr="(?x)                                          # free-spacing (see `RegEx - Pattern Modifiers`)
                        								(?m-i)                                          # ^ and $ match at line-breaks, case-sensitive
                        								^\h*                                            # optional leading white-space at start-of-line
                        								(?:(?-i:                                        # field modifiers
                        										p(?:r(?:ivate|otected)|ublic)           # - access modifiers
                        									|	abstract|final|static                   # - ...
                        								)\s+)*                                          # require a white-space separator
                        								(?-i:function)\s+
                        								\K                                              # discard text matched so far
                        								(?:\x26\s*)?                                    # optionally a reference
                        								(?'VALID_ID'                                    # valid identifier, use as subroutine
                        									\b(?!(?-i:                                  # keywords (case-sensitive), not to be used as identifier
                        										a(?:bstract|nd|rray|s)
                        									|	b(?:ool|reak)
                        									|	c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                        									|	d(?:e(?:clare|fault)|ie|o)
                        									|	e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                        									|	f(?:alse|loat|inal|or(?:each)?|unction)
                        									|	g(?:lobal|oto)
                        									|	i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                        									|	list
                        									|	mixed
                        									|	n(?:amespace|ew|u(?:ll|meric))
                        									|	o(?:r|bject)
                        									|	p(?:r(?:i(?:nt|vate)|otected)|ublic)
                        									|	re(?:quire(?:_once)?|turn)
                        									|	s(?:t(?:atic|ring)|witch)
                        									|	t(?:hrow|r(?:ait|ue|y))
                        									|	u(?:nset|se)
                        									|	var
                        									|	while
                        									|	xor
                        									|	__(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                        									)\b)
                        									[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*            # valid character combination for identifiers
                        								)                                               # identifier used as method name
                        								\s*\(                                           # start of function parameters
                        								[^{]*\{                                         # start of function body
                        							"
                        					>
                        						<functionName>
                        							<funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />
                        							<!-- comment out the following node to display the method with parameters -->
                        							<funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
                        						</functionName>
                        					</function>
                        				</classRange>
                        				<function
                        					mainExpr="(?x)                                              # free-spacing (see `RegEx - Pattern Modifiers`)
                        							(?m-i)                                              # ^ and $ match at line-breaks, case-sensitive
                        							^\h*                                                # optional leading white-space at start-of-line
                        							(?-i:function)\s+
                        							\K                                                  # discard text matched so far
                        							(?:\x26\s*)?                                        # optionally a reference
                        							(?'VALID_ID'                                        # valid identifier, use as subroutine
                        								\b(?!(?-i:                                      # keywords (case-sensitive), not to be used as identifier
                        									a(?:bstract|nd|rray|s)
                        								|	b(?:ool|reak)
                        								|	c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                        								|	d(?:e(?:clare|fault)|ie|o)
                        								|	e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                        								|	f(?:alse|loat|inal|or(?:each)?|unction)
                        								|	g(?:lobal|oto)
                        								|	i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                        								|	list
                        								|	mixed
                        								|	n(?:amespace|ew|u(?:ll|meric))
                        								|	o(?:r|bject)
                        								|	p(?:r(?:i(?:nt|vate)|otected)|ublic)
                        								|	re(?:quire(?:_once)?|turn)
                        								|	s(?:t(?:atic|ring)|witch)
                        								|	t(?:hrow|r(?:ait|ue|y))
                        								|	u(?:nset|se)
                        								|	var
                        								|	while
                        								|	xor
                        								|	__(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                        								)\b)
                        								[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*                # valid character combination for identifiers
                        							)                                                   # identifier used as function name
                        							\s*\(                                               # start of function parameters
                        							[^{]*\{                                             # start of function body
                        						"
                        				>
                        					<functionName>
                        						<nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />
                        						<!-- comment out the following node to display the function with its parameters -->
                        						<nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
                        					</functionName>
                        				</function>
                        			</parser>
                        
                        1 Reply Last reply Reply Quote 0
                        • F
                          Florent Pagès
                          last edited by Feb 11, 2018, 2:43 PM

                          Not working in this case but i focus on the problem : the “$i” in the switch/case.

                          	<?php
                          	class Bad  {
                          		function RsdTitle() { 
                          			$i = 1;
                          		   switch ($i) {
                          				case 1:
                          				$a =  "$i";
                          				break;
                          			}
                          			return "1";   
                          		}    
                          	} 
                          	?>
                          

                          So i tried to change your parser in the commentExpr this way :

                                               # orignal line->  |   (?s:\x22(?:[^\x22\x24\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                                                  |   (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                          

                          It seem to work for me but i am not sure of what i did. (the \x24 is $ caracter)

                          1 Reply Last reply Reply Quote 0
                          • M
                            MAPJe71
                            last edited by Feb 11, 2018, 3:00 PM

                            The original regex would not consider "$i" a double quoted string literal. That’s incorrect (my bad), your adaption is correct.

                            1 Reply Last reply Reply Quote 0
                            • F
                              Florent Pagès
                              last edited by Feb 11, 2018, 5:38 PM

                              Thanks a lot, it works great !

                              I hope it will be included into the next release.

                              1 Reply Last reply Reply Quote 0
                              • M
                                MAPJe71
                                last edited by Feb 11, 2018, 5:40 PM

                                I will include it in Function List Update 4.

                                1 Reply Last reply Reply Quote 0
                                • F
                                  Florent Pagès
                                  last edited by Feb 11, 2018, 5:51 PM

                                  Super. Functions list is very useful for me.

                                  I hope “functions list” will be improved: showing line number , jumping on class name or synch selection on edit location.

                                  1 Reply Last reply Reply Quote 0
                                  • F
                                    Florent Pagès
                                    last edited by Nov 22, 2018, 10:04 AM

                                    I have change a line in functionList.xml in the php parser :

                                    							# Old line: [^{]*\{                                       # start of function body
                                                                (?:[^{;]*(?:\{|;))                                         # start of function body
                                    

                                    It fixes the problem that an abstract function doesn’t have body.

                                    1 Reply Last reply Reply Quote 0
                                    • F
                                      Florent Pagès
                                      last edited by Nov 22, 2018, 11:46 AM

                                      full PHP parser

                                      		<!-- ========================================================= [ PHP ] -->
                                      		<!-- PHP - Personal Home Page / PHP Hypertext Preprocessor             -->
                                      
                                            <parser
                                                  displayName="PHP - Personal Home Page / PHP Hypertext Preprocessor"
                                                  id         ="php_syntax"
                                                  commentExpr="(?x)                                               # free-spacing (see `RegEx - Pattern Modifiers`)
                                                                  (?s:\x2F\x2A.*?\x2A\x2F)                        # Multi Line Comment  x2F -> '/'  x2A -> '*'  
                                                              |   (?m-s:(?:\x23|\x2F{2}).*$)                      # Single Line Comment 1 # and 2 //
                                                            #  |   (?s:\x22(?:[^\x22\x24\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                                                              |   (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22)         # String Literal - Double Quoted
                                                              |   (?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27)             # String Literal - Single Quoted
                                                              |   (?:                                             # Here Document
                                                                      \x3C{3}(?'HDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)[^\r\n]*(?:\r?\n|\n?\r)
                                                                      (?s:.*?)
                                                                      (?:\r?\n|\n?\r)\k'HDID'                     # close with exactly the same identifier, in the first column
                                                                  )
                                                              |   (?:                                             # Now Document
                                                                      \x3C{3}\x27(?'NDID'[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*)\x27[^\r\n]*(?:\r?\n|\n?\r)
                                                                      (?s:.*?)
                                                                      (?:\r?\n|\n?\r)\k'NDID'                     # close with exactly the same identifier, in the first column
                                                                  )
                                                              "
                                              >
                                                  <classRange
                                                      mainExpr    ="(?x)                                          # free-spacing (see `RegEx - Pattern Modifiers`)
                                                              (?(DEFINE)                                          # definition of sub-routines
                                                                  (?'VALID_ID'
                                                                      \b(?!(?-i:                                  # keywords (case-sensitive), not to be used as identifier
                                                                          a(?:bstract|nd|rray|s)
                                                                      |   b(?:ool|reak)
                                                                      |   c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                                                                      |   d(?:e(?:clare|fault)|ie|o)
                                                                      |   e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                                                                      |   f(?:alse|loat|inal|or(?:each)?|unction)
                                                                      |   g(?:lobal|oto)
                                                                      |   i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                                                                      |   list
                                                                      |   mixed
                                                                      |   n(?:amespace|ew|u(?:ll|meric))
                                                                      |   o(?:r|bject)
                                                                      |   p(?:r(?:i(?:nt|vate)|otected)|ublic)
                                                                      |   re(?:quire(?:_once)?|turn)
                                                                      |   s(?:t(?:atic|ring)|witch)
                                                                      |   t(?:hrow|r(?:ait|ue|y))
                                                                      |   u(?:nset|se)
                                                                      |   var
                                                                      |   while
                                                                      |   xor
                                                                      |   __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                                                                      )\b)
                                                                      [A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*            # valid character combination for identifiers
                                                                  )
                                                                  (?'INTERFACE_LIST'
                                                                      \s+(?:\x5C|(?&amp;VALID_ID))+
                                                                      (?:
                                                                          \s*,
                                                                          \s*(?:\x5C|(?&amp;VALID_ID))+
                                                                      )*
                                                                  )
                                                              )
                                                              (?m-i)                                              # ^ and $ match at line-breaks, case-sensitive
                                                              ^\h*                                                # optional leading white-space at start-of-line
                                                              (?:
                                                                  (?:(?-i:abstract|final)\s+)?                    # optional class entry type
                                                                  (?-i:class)\s+
                                                                  \K                                              # discard text matched so far
                                                                  (?&amp;VALID_ID)                                # identifier used as class name
                                                                  (?:                                             # optional extends-from-class
                                                                      \s+(?-i:extends)
                                                                      \s+(?:\x5C|(?&amp;VALID_ID))+
                                                                  )?
                                                                  (?:                                             # optional implements-class/interfaces
                                                                      \s+(?-i:implements)
                                                                      (?&amp;INTERFACE_LIST)
                                                                  )?
                                                              |
                                                                  (?-i:interface)\s+
                                                                  \K                                              # discard text matched so far
                                                                  (?&amp;VALID_ID)                                # identifier used as interface name
                                                                  (?:                                             # optional extends-from list
                                                                      \s+(?-i:extends)
                                                                      (?&amp;INTERFACE_LIST)
                                                                  )?
                                                              |
                                                                  (?-i:trait)\s+
                                                                  \K                                              # discard text matched so far
                                                                  (?&amp;VALID_ID)                                # identifier used as trait name
                                                              )
                                                              \s*\{
                                                          "
                                                      openSymbole ="\{"
                                                      closeSymbole="\}"
                                                  >
                                                      <className>
                                                          <nameExpr expr="[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />
                                                      </className>
                                                      <function
                                                          mainExpr="(?x)                                          # free-spacing (see `RegEx - Pattern Modifiers`)
                                                                  (?m-i)                                          # ^ and $ match at line-breaks, case-sensitive
                                                                  ^\h*                                            # optional leading white-space at start-of-line
                                                                  (?:(?-i:                                        # field modifiers
                                                                          p(?:r(?:ivate|otected)|ublic)           # - access modifiers
                                                                      |   abstract|final|static                   # - ...
                                                                  )\s+)*                                          # require a white-space separator
                                                                  (?-i:function)\s+
                                                                  \K                                              # discard text matched so far
                                                                  (?:\x26\s*)?                                    # optionally a reference
                                                                  (?'VALID_ID'                                    # valid identifier, use as subroutine
                                                                      \b(?!(?-i:                                  # keywords (case-sensitive), not to be used as identifier
                                                                          a(?:bstract|nd|rray|s)
                                                                      |   b(?:ool|reak)
                                                                      |   c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                                                                      |   d(?:e(?:clare|fault)|ie|o)
                                                                      |   e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                                                                      |   f(?:alse|loat|inal|or(?:each)?|unction)
                                                                      |   g(?:lobal|oto)
                                                                      |   i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                                                                      |   list
                                                                      |   mixed
                                                                      |   n(?:amespace|ew|u(?:ll|meric))
                                                                      |   o(?:r|bject)
                                                                      |   p(?:r(?:i(?:nt|vate)|otected)|ublic)
                                                                      |   re(?:quire(?:_once)?|turn)
                                                                      |   s(?:t(?:atic|ring)|witch)
                                                                      |   t(?:hrow|r(?:ait|ue|y))
                                                                      |   u(?:nset|se)
                                                                      |   var
                                                                      |   while
                                                                      |   xor
                                                                      |   __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                                                                      )\b)
                                                                      [A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*            # valid character combination for identifiers
                                                                  )                                               # identifier used as method name
                                                                  \s*\(                                           # start of function parameters
                                                                  (?:[^{;]*(?:\{|;))                              # start of function body  or abstract function without body
                                                              "
                                                      >
                                                          <functionName>
                                                              <funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />							
                                                              <!-- comment out the following node to display the method with parameters -->
                                                              <funcNameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" />  
                                                          </functionName>
                                                      </function>
                                                  </classRange>
                                                  <function
                                                      mainExpr="(?x)                                              # free-spacing (see `RegEx - Pattern Modifiers`)
                                                              (?m-i)                                              # ^ and $ match at line-breaks, case-sensitive
                                                              ^\h*                                                # optional leading white-space at start-of-line
                                                              (?-i:function)\s+
                                                              \K                                                  # discard text matched so far
                                                              (?:\x26\s*)?                                        # optionally a reference
                                                              (?'VALID_ID'                                        # valid identifier, use as subroutine
                                                                  \b(?!(?-i:                                      # keywords (case-sensitive), not to be used as identifier
                                                                      a(?:bstract|nd|rray|s)
                                                                  |   b(?:ool|reak)
                                                                  |   c(?:a(?:llable|se|tch)|l(?:ass|one)|on(?:st|tinue))
                                                                  |   d(?:e(?:clare|fault)|ie|o)
                                                                  |   e(?:cho|lse(?:if)?|mpty|nd(?:declare|for(?:each)?|if|switch|while)|val|x(?:it|tends))
                                                                  |   f(?:alse|loat|inal|or(?:each)?|unction)
                                                                  |   g(?:lobal|oto)
                                                                  |   i(?:f|mplements|n(?:clude(?:_once)?|st(?:anceof|eadof)|t(?:erface)?)|sset)
                                                                  |   list
                                                                  |   mixed
                                                                  |   n(?:amespace|ew|u(?:ll|meric))
                                                                  |   o(?:r|bject)
                                                                  |   p(?:r(?:i(?:nt|vate)|otected)|ublic)
                                                                  |   re(?:quire(?:_once)?|turn)
                                                                  |   s(?:t(?:atic|ring)|witch)
                                                                  |   t(?:hrow|r(?:ait|ue|y))
                                                                  |   u(?:nset|se)
                                                                  |   var
                                                                  |   while
                                                                  |   xor
                                                                  |   __(?:halt_compiler|(?:CLASS|DIR|F(?:ILE|UNCTION)|LINE|METHOD|NAMESPACE|TRAIT)__)
                                                                  )\b)
                                                                  [A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*                # valid character combination for identifiers
                                                              )                                                   # identifier used as function name
                                                              \s*\(                                               # start of function parameters
                                                              [^{]*\{                                             # start of function body 
                                                          "
                                                  >
                                                      <functionName>
                                                          <nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*\s*\((?:[^/{]|/(?![*/]))*" />
                                                          <!-- comment out the following node to display the function with its parameters -->
                                                          <!-- <nameExpr expr="(?:\x26\s*)?[A-Za-z_\x7F-\xFF][\w\x7F-\xFF]*" /> -->
                                                      </functionName>
                                                  </function>
                                              </parser>
                                      
                                      1 Reply Last reply Reply Quote 3
                                      • F
                                        Florent Pagès
                                        last edited by Nov 26, 2018, 7:08 PM

                                        I join GitHub, but I not sure of what I did for submit this piece of code.

                                        https://github.com/TutoInformatik/notepad-plus-plus/pulls?q=is%3Apr+is%3Aclosed

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