Community
    • Login

    Function list and AutoIt / AU3 files

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    10 Posts 4 Posters 7.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dave HbsKD
      Dave HbsK
      last edited by

      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"/>
      

      and

      		<parser id="au3_function" displayName="Au3 script" >
      			<function
      			    mainExpr="^\s*func\s+\w+\(.*"
      				displayMode="$functionName">
      				<functionName>
      					<nameExpr expr=".*"/>
      				</functionName>
      			</function>
      		</parser>
      

      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 :
      https://notepad-plus-plus.org/features/function-list.html

      Thanks for your help and have a nice day.

      Dave.

      1 Reply Last reply Reply Quote 0
      • MAPJe71M
        MAPJe71
        last edited by MAPJe71

        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*\(" >
              <functionName>
                <nameExpr expr="(?mi)(?&lt;=^\h*func\h+)\w+" />
              </functionName>
            </function>
          </parser>
        
        1 Reply Last reply Reply Quote 0
        • binbinhfrB
          binbinhfr
          last edited by

          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*\(" >
          				<functionName>
          					<nameExpr expr="^\h*func\h+\w+" />
          

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

          1 Reply Last reply Reply Quote 0
          • MAPJe71M
            MAPJe71
            last edited by

            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*\([^()]*?\)" >
                  <functionName>
                    <nameExpr expr="(?!(?i:FUNC)\s+)[A-Za-z_]\w*\s*\(" />
                    <nameExpr expr="[A-Za-z_]\w*" />
                  </functionName>
                </function>
              </parser>
            
            1 Reply Last reply Reply Quote 0
            • binbinhfrB
              binbinhfr
              last edited by

              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 ?

              1 Reply Last reply Reply Quote 0
              • MAPJe71M
                MAPJe71
                last edited by

                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
                EndFunc
                

                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.

                1 Reply Last reply Reply Quote 0
                • binbinhfrB
                  binbinhfr
                  last edited by

                  Thanks for the explanation

                  1 Reply Last reply Reply Quote 0
                  • MartianM
                    Martian
                    last edited by

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

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

                    1 Reply Last reply Reply Quote 0
                    • MAPJe71M
                      MAPJe71
                      last edited by

                      @Martian the commentExpr is incorrect.

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

                      MartianM 1 Reply Last reply Reply Quote 0
                      • MartianM
                        Martian @MAPJe71
                        last edited by

                        @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

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors