FAQ Desk: Function List Basics



  • 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
    
    


  • 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"                          />
      
    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.



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


Log in to reply