Community
    • Login

    FAQ: Function List Basics

    Scheduled Pinned Locked Moved FAQ
    faqfunctionlist
    3 Posts 2 Posters 5.3k Views 2 Watching
    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.
    • MAPJe71M Offline
      MAPJe71
      last edited by PeterJones

      Function List parse steps:

      1. The <parser> “commentExpr”-attribute is used to find all the comment code blocks;
      2. The <classRange> “mainExpr”-attribute is used to find all the class code blocks in the none-comment code blocks;
      3. For each class code block found:
        1. The <classRange><className><nameExpr> “expr”-attribute is used to find the classes name;
        2. The <classRange><function> “mainExpr”-attribute is used to find the method definitions;
        3. For each method definition found within the class code block:
          1. The <classRange><function><functionName><funcNameExpr> “expr”-attribute is used to find the method’s name;
          2. The method is added to the trunk of the tree as branch-leaf using class name and method name respectively;
      4. For each remaining code block i.e. neither being a comment nor a class code block:
        1. The <function> “mainExpr”-attribute is used to find the function and method definitions;
        2. For each function/method definition:
          1. The <function><functionName><nameExpr> “expr”-attribute is used to find the function/method’s name;
          2. The <function><className> “expr”-attribute is used to find the function/method’s class name;
          3. The function/method is added to the trunk of the tree as:
            1. a branch-leaf using class name and method name respectively when a class name was found;
            2. a leaf using the function name when no a class name was found;

      ExampleClass.hpp

      class ExampleClass {
        void Method1();
        void Method2() {
          return;
        }
        void Method3();
      }
      void ExampleClass::Method1() {
        return;
      }
      

      Collapsed:

      class ExampleClass {\r\n  void Method1();\r\n  void Method2() {\r\n    return;\r\n  }\r\n  void Method3();\r\n}\r\nvoid ExampleClass::Method1() {\r\n  return;\r\n}\r\n
      
      |<-1--------------------------------------------------------------------------------------------------------->|    |<-2------------------------>|
            |<-3------>|                             |<-4---------->|                                                         |<-5------>|  |<-6->|
                                                          |<-7->|
      

      Description for numbered code blocks:

      1. class definition to be matched by <classRange> “mainExpr”-attribute optionally combined with “openSymbol” and “closeSymbol”-attributes;
      2. function definition to be matched by <function> “mainExpr”-attribute;
      3. class name to be matched by <classRange><className><nameExpr> “expr”-attribute;
      4. function definition to be matched by <classRange><function> “mainExpr”-attribute;
      5. class name to be matched by <function><className> “expr”-attribute;
      6. function name to be matched by <function><functionName><nameExpr> “expr”-attribute;
      7. function name to be matched by <classRange><function><functionName><funcNameExpr> “expr”-attribute;

      Result:

      ExampleClass.hpp
      \--- ExampleClass
           +--- Method2
           \--- Method1
      

      Note:
      When the list is unsorted Method2 is listed before Method1 as class code blocks are parsed before any remaining code blocks

      ExampleClass.cpp

      #include "ClassExample.h"
      void HelperFunction() {
        return;
      }
      void ExampleClass::Method3() {
        return;
      }
      

      Collapsed:

      #include "ClassExample.h"\r\nvoid HelperFunction() {\r\n  return;\r\n}\r\nvoid ExampleClass::Method3() {\r\n  return;\r\n}\r\n
      
                                   |<-1----------------->|                      |<-2------------------------>|
                                        |<-3-------->|                               |<-4------>|  |<-5->|
      

      Description for numbered code blocks:

      1. function definition to be matched by <function> “mainExpr”-attribute;
      2. function definition to be matched by <function> “mainExpr”-attribute;
      3. function name to be matched by <function><functionName><nameExpr> “expr”-attribute;
      4. class name to be matched by <function><className> “expr”-attribute;
      5. function name to be matched by <function><functionName><nameExpr> “expr”-attribute;

      Result:

      ExampleClass.hpp
      +--- ExampleClass
      |    \--- Method3
      |
      \--- HelperFunction
      
      
      1 Reply Last reply Reply Quote 4
      • MAPJe71M Offline
        MAPJe71
        last edited by PeterJones

        Known Issues:

        1. Comment has to be preceded by at least two white-space characters e.g. carriage-return + line-feed, line-feed + one space or tab, or 2 spaces (for inline comment).

        2. The file has to end with an empty line.
          e.g.

           class ThisClassWillNotShowUp {CRLF
               void Method() {CRLF
               }CRLF
           }EOF
          

          and

           class ThisClassWillShowUp {CRLF
               void Method() {CRLF
               }CRLF
           }CRLF
           EOF
          
        3. “Embedded” comment is not supported when the ‘commentExpr’-attribute is defined. All the comment blocks (found in parse step 1) are skipped when searching for class code blocks (parse step 2) and method/function code blocks (parse step 3.3 and 4, resp.) i.e. the function definition has to start and end in the same non-comment zone (even if ‘mainExpr’ takes into account function-definition-embedded comments).

          e.g. C/C++ function definition with “embedded” comment:

           void                                                   /* comment */
           FunctionName                                           /* comment */
           (                                                      /* comment */
             /* comment */Argument1Type/* comment */Argument1Name /* comment */
                                                                  /* comment */
           , Argument2Type Argument2Name                          /* comment */
           , ...                                                  /* comment */
           )                                                      /* comment */
          
        4. A file extension association requires at least one (dummy) UDL association.

          e.g.

          <association id="markdown_header" userDefinedLangName="Markdown (Default)" />
          <association id="markdown_header" userDefinedLangName="CommonMark"         />
          <association id="markdown_header" userDefinedLangName="MultiMarkdown"      />
          <association id="markdown_header" ext=".md"                                />
          <association id="markdown_header" ext=".markdown"                          />
          

          Update: Starting in v7.9.1, the ext is no longer used, and Function List definitions must be mapped to either a built-in language or a named User Defined Language.

        5. The ‘userDefinedLangName’-attribute value has to match the name of the UDL exactly as it appears in the ‘Language’-menu i.e. case-sensitive.

        1 Reply Last reply Reply Quote 3
        • PeterJonesP Offline
          PeterJones
          last edited by

          For the interested user, @MAPJe71 has a collection of Notepad++ Function List definitions (and other useful files) for a wide variety of programming languages:

          • https://github.com/MAPJe71/Languages
          1 Reply Last reply Reply Quote 3
          • Michael VincentM Michael Vincent referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • PeterJonesP PeterJones referenced this topic on
          • mkupperM mkupper referenced this topic on
          • Lycan ThropeL Lycan Thrope referenced this topic on
          • PeterJonesP PeterJones referenced this topic on

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors