FAQ: Function List Basics
-
Function List parse steps:
- The
<parser>
“commentExpr”-attribute is used to find all the comment code blocks; - The
<classRange>
“mainExpr”-attribute is used to find all the class code blocks in the none-comment code blocks; - For each class code block found:
- The
<classRange><className><nameExpr>
“expr”-attribute is used to find the classes name; - The
<classRange><function>
“mainExpr”-attribute is used to find the method definitions; - For each method definition found within the class code block:
- The
<classRange><function><functionName><funcNameExpr>
“expr”-attribute is used to find the method’s name; - The method is added to the trunk of the tree as branch-leaf using class name and method name respectively;
- The
- The
- For each remaining code block i.e. neither being a comment nor a class code block:
- The
<function>
“mainExpr”-attribute is used to find the function and method definitions; - For each function/method definition:
- The
<function><functionName><nameExpr>
“expr”-attribute is used to find the function/method’s name; - The
<function><className>
“expr”-attribute is used to find the function/method’s class name; - The function/method is added to the trunk of the tree as:
- a branch-leaf using class name and method name respectively when a class name was found;
- a leaf using the function name when no a class name was found;
- The
- The
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:
- class definition to be matched by
<classRange>
“mainExpr”-attribute optionally combined with “openSymbol” and “closeSymbol”-attributes; - function definition to be matched by
<function>
“mainExpr”-attribute; - class name to be matched by
<classRange><className><nameExpr>
“expr”-attribute; - function definition to be matched by
<classRange><function>
“mainExpr”-attribute; - class name to be matched by
<function><className>
“expr”-attribute; - function name to be matched by
<function><functionName><nameExpr>
“expr”-attribute; - 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 blocksExampleClass.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:
- function definition to be matched by
<function>
“mainExpr”-attribute; - function definition to be matched by
<function>
“mainExpr”-attribute; - function name to be matched by
<function><functionName><nameExpr>
“expr”-attribute; - class name to be matched by
<function><className>
“expr”-attribute; - function name to be matched by
<function><functionName><nameExpr>
“expr”-attribute;
Result:
ExampleClass.hpp +--- ExampleClass | \--- Method3 | \--- HelperFunction
- The
-
Known Issues:
-
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).
-
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
-
“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 */
-
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. -
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:
-
-
-
-
-
-
-
-
-
-