Can't seem to get functionList.xml to recognize my UDL



  • I’m working with text files and would like to use the function list to display sections in my files. Sections are denoted by the word, “Section”. For example:

    Section Test1
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam imperdiet leo eu tincidunt iaculis. Suspendisse potenti. Vestibulum sodales lacinia nisl, a bibendum quam laoreet et. Donec ut quam sagittis, pretium lorem non, iaculis turpis. Morbi ante neque, lacinia in libero quis, maximus efficitur nibh. Mauris sit amet nunc varius, pharetra urna id, vestibulum tortor. Curabitur eu elit ut mi pellentesque tincidunt. Sed gravida suscipit est quis interdum.
    
    Section Test 2
    Mauris auctor diam in ante elementum vestibulum. Proin at auctor enim. Curabitur dignissim, erat non rutrum fringilla, purus mauris condimentum nunc, sed varius risus velit et nisi. Praesent ac fermentum ligula. Nam cursus orci tincidunt mauris semper pharetra. Etiam ultrices ipsum ut felis iaculis efficitur. Quisque consequat arcu vitae tincidunt tincidunt. Praesent viverra tincidunt diam id pharetra.
    

    I have a user defined language called, SA Network v0.2.

    My functionList.xml (I’ve been working with the file in %appdata%, but have also tried editing the file in \program files\)

    ...
    <association userDefinedLangName="SA Network v0.2" id="sanet_sections"/>
    ...
    
    <parser id="sanet_sections" displayName="Configuration Sections">
      <function mainExpr="Section.+" displayMode="$functionName">
      </function>
    </parser>
    

    I’ve simplified the configuration as much as possible, but I still can’t get anything to display in the function list. What am I doing wrong?



  • @Azannah Please try the following association/parser:

    			<association id=       "sanet_section"       userDefinedLangName="SANET"           />
    			<association id=       "sanet_section"       ext=".san"                            />
    
    			<!--
    			|   https://notepad-plus-plus.org/community/topic/14808/can-t-seem-to-get-functionlist-xml-to-recognize-my-udl
    			\-->
    			<parser
    				displayName="[UDL] SA Network Configuration Section"
    				id         ="sanet_section"
    			>
    				<function
    					mainExpr="(?x)                                              # free-spacing (see `RegEx - Pattern Modifiers`)
    							(?im)                                               # case-insensitive, ^ and $ match at line-breaks
    							^\h*                                                # optional leading white-space at start-of-line
    							SECTION
    							\K                                                  # discard text matched so far
    							[^\r\n]+                                            # whatever,
    							$                                                   # ...up till end-of-line
    						"
    				/>
    			</parser>
    

    REMARK:
    Make sure the value for “userDefinedLangName” (e.g. “SANET” in my case) exactly matches the name of your UDL i.e. as visible in the N++ “Language” menu.



  • Thanks, @MAPJe71 - that worked! You’r comment style for RegEx is also helpful.

    Best regards


Log in to reply