Function list new language parser



  • I’m doing some testing with the Function-List language parser

    Just trying with a super simple language definition
    to explore the features…

    I created the <association …/> and the <parser …>
    and restarted NPP… but cant put tis to work

    • Here is the my xml/association element
    <association 
        id = "XXX" 
        userDefinedLangName = "XXX-Testing..."  
        ext = ".xxx" 
        />
    
    • And here is my very…very simple parser
    • I just want to match the “xxx” string in the text
    • just testing… there are various “xxx” inside the text
    • not even regex metatags… all super simple
    <parser
        id = "XXX"
        displayName = "XXX"
        commentExpr = "(?s:/\*.*?\*/)|(?m-s://.*?$)"
        >
        <function 
            mainExpr = "XXX" 
            >
    
            <funcNameExpr expr=".*" />
        </function>
    </parser>
    

    ?Any ideas
    my NPP version is 7.7.1
    but I download some older versions to test and the problem remains…



  • @IBIT_ZEE said in Function list new language parser:

    <association
    id = “XXX”
    userDefinedLangName = “XXX-Testing…”
    ext = “.xxx”
    />

    you can see under functionlistxml line 94

    		<association id=         "krl_function"   userDefinedLangName="KRL"            />
    		<association id=         "krl_function"   ext=".src"                           />
    		<association id=         "krl_function"   ext=".sub"                           />
    		<!-- ======================================================================== -->
    		<association id=   "sinumerik_function"   userDefinedLangName="Sinumerik"      />
    		<association id=   "sinumerik_function"   ext=".arc"                           />
    		<!-- ======================================================================== -->
    		<association id=    "universe_basic"      userDefinedLangName="UniVerse BASIC" />
    		<association id=    "universe_basic"      ext=".bas"                           />


    1. Due to a flaw in the implementation of the Function List engine an id-ext-association has to be combined with an id-userDefinedLangName-association. Not sure if combining the two of them in one assocciation-node should work. Separating should definitly work though i.e.
    <association id="XXX" userDefinedLangName="XXX-Testing..."/>
    <association id="XXX" ext=".xxx"/>
    
    1. Make sure the ‘userDefinedLangName’-attribute’s value exactly equals the name of the user defined language as displayed in the ‘Language’-menu i.e. upper- and lowercase letters, hyphens, etc. I your case their should be “XXX-Testing…” entry in the Language-menu.
    2. If not yet created, create the applicable user-defined-language. Yours should be named XXX-Testing... with its extension field (Ext.:) set to xxx i.e. without the dot.
    3. Make sure your parser-node has the correct layout i.e.
    <parser
        displayName="XXX"
        id         ="XXX"
        commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    >
        <function 
            mainExpr="XXX" 
        >
            <functionName>
                <nameExpr expr=".*" />
            </functionName>
        </function>
    </parser>
    

    In this case the functionName-node might not be necessary i.e.

    <parser
        displayName="XXX"
        id         ="XXX"
        commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    >
        <function 
            mainExpr="XXX" 
        />
    </parser>
    


  • Thanks @MAPJe71

    it was the “userDefinedLangName”
    was set to “XXX-…” and should be “xxx-…”
    to exactly match the name of the language
    in the Language menu… (it is case sensitive…)