Notepad++ FunctionList parser for NppExec plugin scripting language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- ==========================================================================\ | |
| | |
| To learn how to make your own language parser, please check the following | |
| link: | |
| https://npp-user-manual.org/docs/function-list/ | |
| | |
\=========================================================================== --> | |
<NotepadPlus> | |
<functionList> | |
<!-- ===================================================== [ NppExec ] --> | |
<parser | |
displayName="NppExec" | |
id ="nppexec_syntax" | |
> | |
<!-- Define NppExec script as the range started by a pair of colons | |
and ending right before the next pair of colons or the file's | |
end, respectively | |
--> | |
<classRange | |
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) | |
(?ims) # ignore case, ^ and $ match start/end of line, dot matches newline | |
^\h* | |
:: | |
.*? | |
(?=::|\Z) | |
" | |
> | |
<className> | |
<!-- The script's name is shown without its preceding pair | |
of colons | |
--> | |
<nameExpr expr="(?im-s)^\h*::\K(?:(.+?)(?=\h*\/{2}|$))" /> | |
</className> | |
<!-- Define jump labels as functions. Names are starting with one | |
or two colons (thus the script's name itself is shown as a | |
function) and terminated by a line comment, the line's end | |
or the file's end | |
--> | |
<function | |
mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) | |
(?im-s) # ignore case, ^ and $ match start/end of line, dot doesn't match newline | |
^\h* | |
:{1,2}.+? | |
\h*(?=\/{2}|$|\Z) | |
" | |
> | |
<functionName> | |
<!-- The script name is shown including its preceding pair | |
of colons, jump labels are shown without the preceding | |
single colon | |
--> | |
<funcNameExpr expr="(?im-s)\h*(?(?=::)(.+)|(?::\K(.+)))" /> | |
</functionName> | |
</function> | |
</classRange> | |
</parser> | |
</functionList> | |
</NotepadPlus> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
To get a working function list for NppExec scripts you also need a user defined language (UDL) for syntax highlighting NppExec scripts. You can obtain a ready-made UDL file here.
Installation
The following steps depend on the version of Notepad++ you use.
Notepad++ versions prior to v7.9.1
AppData\Roaming\Notepad++
. If theAppData
folder is not shown in your user profile folder, you need to go to the Windows Explorer folder options and enable the display of hidden files and folders..b) If you use a portable version of Notepad++: Open the folder where your
notepad++.exe
resides.functionList.xml
from that folder with Notepad++./NotepadPlus/functionList/parser
XML node into the filefunctionList.xml
as a child node of the/NotepadPlus/functionList/parsers
XML node.functionList.xml
go to the XML node/NotepadPlus/functionList/associationMap
. There you will find XML nodes like<association id="xxx" userDefinedLangName="xxx" />
.<association id="nppexec_syntax" userDefinedLangName="NppExec" />
. Please note: The value of theuserDefinedLangName
attribute has to be the same like in the UDL file's/NotepadPlus/UserLang
XML node'sname
attribute. In case you downloaded the UDL file from the link given above, everything is already set up the right way.Notepad++ version v7.9.1 and above
AppData\Roaming\Notepad++
. If theAppData
folder is not shown in your user profile folder, you need to go to the Windows Explorer folder options and enable the display of hidden files and folders.b) If you use a portable version of Notepad++: Open the folder where your
notepad++.exe
resides.functionList
and move the XML file you downloaded and unzipped in the steps above to this folder.overrideMap.xml
from the folderfunctionList
and go to the XML node/NotepadPlus/functionList/associationMap
. There you will find XML nodes like<association id="xxx.xml" userDefinedLangName="xxx" />
.<association id="nppexec.xml" userDefinedLangName="NppExec" />
. Please note: The value of theuserDefinedLangName
attribute has to be the same like in the UDL file's/NotepadPlus/UserLang
XML node'sname
attribute. In case you downloaded the UDL file from the link given above, everything is already set up the right way. Additionally, the value of theid
attribute has to be the file name of the XML file you moved to thefunctionList
folder in step 2.