Configuring Notepad ++ "Feature List" for Perl

I am trying to get the Fucntion List function in notepad ++ (v 6.7.5) that works in Perl with classes (or packages, in the perl language). By default, only regular routines outside of packages are supported.

The following is an XML snippet from the function list configuration file (located on my Windows machine in the C: \ Users \ user \ AppData \ Roaming \ Notepad ++ \ functionList.xml folder). I added the "classRange" node itself on top of the "default" node function.

EDIT: below adjusted XML, thanks to user stribizhev

UPDATE: I commented on the “normal” function section because it made all my methods appear twice in the function list.

<parser id="perl_function" displayName="Perl">
    <classRange mainExpr="^package.*?(?=\npackage|\Z)">
        <className>
            <nameExpr expr="\s\K[^;]+"/>
        </className>
        <function mainExpr="^[\s]*(?&lt;!#)[\s]*sub[\s]+[\w]+[\s]*\(?[^\)\(]*?\)?[\n\s]*\{" displayMode="$className->$functionName">
            <functionName>
                <funcNameExpr expr="(sub[\s]+)?\K[\w]+"/>
            </functionName>
        </function>
    </classRange>
    <!--
    <function mainExpr="^[\s]*(?&lt;!#)[\s]*sub[\s]+[\w]+[\s]*\(?[^\)\(]*?\)?[\n\s]*\{" displayMode="$className->$functionName">
        <functionName>
            <nameExpr expr="(sub[\s]+)?\K[\w]+"/>
        </functionName>
    </function>
    -->
</parser>

The documentation for this is here .

+4
2

, funcNameExpr nameExpr:

:

<functionName>
    <funcNameExpr expr="(sub[\s]+)?\K[\w]+"/>
</functionName>
+2

XML Notepad ++ 6.8.1, , Perl "", . , , , , , - "".

subs POD ( ), :

        <parser id="perl_function" displayName="Perl" commentExpr="(#.*?$|(__END__.*\Z))">
            <classRange mainExpr="(?&lt;=^package).*?(?=\npackage|\Z)">
                <className>
                    <nameExpr expr="\s\K[^;]+"/>
                </className>
                <function mainExpr="^[\s]*(?&lt;!#)[\s]*sub[\s]+[\w]+[\s]*\(?[^\)\(]*?\)?[\n\s]*\{">
                    <functionName>
                        <funcNameExpr expr="(sub[\s]+)?\K[\w]+"/>
                    </functionName>
                </function>
            </classRange>
            <function mainExpr="^[\s]*(?&lt;!#)[\s]*sub[\s]+[\w]+[\s]*\(?[^\)\(]*?\)?[\n\s]*\{">
                <functionName>
                    <nameExpr expr="(?:sub[\s]+)?\K[\w]+"/>
                </functionName>
            </function>
        </parser>
+3

All Articles