Function list and AutoIt / AU3 files

  • Hi there,

    my name is Dave and I am a big fan of NotePad++ and I am trying to customize it as far as I can. And as I am writing some AutoIt stuff at the moment, I try to find or write a parser to include into functionList.xml to add recognition of AU3 functions.
    They look like this :

    Func function_name(parameters)

    and comments are delimitated by a “;” : everything on the right of the “;” is ignored.

    as a first try, I added this :

    		<association langID="40" id="au3_function"/>


    		<parser id="au3_function" displayName="Au3 script" >
    					<nameExpr expr=".*"/>

    the function list seems to detect the AU3 file, but nothing appears…

    subsidiary question : is the function list parser case sensitive ? because I type “func” but it could be “Func” or “FUNC” or any other combination…

    Notepad++ doc on the subject :

    Thanks for your help and have a nice day.


  • Try this parser:

      <parser id="au_function" displayName="AutoIt3" commentExpr="(((?mi-s)^\h*;.*?$)/|((?s-m)#cs.*?#ce))" >
        <function mainExpr="(?i)^\h*func\h+\w+\h*\(" >
            <nameExpr expr="(?mi)(?&lt;=^\h*func\h+)\w+" />

  • Hi,

    thanks a lot for the answer.
    sorry to reply with another login, but I cannot login with my google+ on firefox… strange.
    So I tried what you said, but it does not match at all.
    So I tried to simplify and the only thing that worked was :

    			<function mainExpr="^\h*func\h+\w+\h*\(" >
    					<nameExpr expr="^\h*func\h+\w+" />

    but it returns “func” before each function name.
    I do not understand why (?<= does not work…

  • Mea Culpa, didn’t test it, just copied from my FuncionList.xml.

    Try this (tested and confirmed!) parser:

      <parser id="au3_function" displayName="AutoIt3" commentExpr="(?mi-s)^\s*;.*?$|(?s-m)#cs.*?#ce" >
        <function mainExpr="^\s*(?i:FUNC)\s+[A-Za-z_]\w*\s*\([^()]*?\)" >
            <nameExpr expr="(?!(?i:FUNC)\s+)[A-Za-z_]\w*\s*\(" />
            <nameExpr expr="[A-Za-z_]\w*" />

  • Thanks a lot !
    It works like a charm.
    I understood what you did,
    I just have a problem with the [^()]*? part between the two function parenthesis at the end of mainExpr.
    And what about (?!func\s+). Does it mean that I don’t want a func patern at the right ? Why not a positive lookbehind with ?<= is not working ?

    Could you explain to a novice ?

  • With the [^()]*? (none greedy zero or more characters not being parenthesis) I was aiming for the possibility to include the function parameters in the tree view.

    (?!(?i:FUNC)\s+)) should have been (?!(?i:FUNC)\b)) so you can even use function names starting with func, Func, fUNC, FUNC, FuNc, etc. e.g.

    Func functionNameExample()
         ; function body

    Positive look behind is supported since Boost v1.33.0.
    So in theory it should be supported as Notepad++ is using Boost v1.55.0 for the RegEx engine in its custom Scintilla build.

  • Thanks for the explanation

  • Hi!
    here is an alternative working version of the author AZJIO
    You need to Don Ho added support for AU3 functions in functionList.xml
    it will be more convenient and useful for many users.
    Sorry for the emphasis is the translator.

    <parser id=“au3_function” displayName=“au3 Func” commentExpr="(((?m)^\h*;.?$)/|((?s)#cs.?#ce))"> <!-- комментарий, где игнорировать -->
    <!-- то, к чему совершать прыжок -->
    <nameExpr expr="(?mi)(?<=^Func\h)([_A-Za-z0-9]+)"/> <!-- захватить имена в список функций -->

  • @Martian the commentExpr is incorrect.

    FYI PR #2602 - FunctionList Update 2 includes an AutoIt3 parser.

  • @MAPJe71 said:

    @Martian the commentExpr is incorrect.

    FYI PR #2602 - FunctionList Update 2 includes an AutoIt3 parser.

    Thank you MAPJe71
    I meant it to be in the official Notepad ++ installer

Log in to reply