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"/>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.htmlThanks for your help and have a nice day.
Dave.
-
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)(?<=^\h*func\h+)\w+" /> </functionName> </function> </parser> -
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… -
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> -
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 EndFuncPositive 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 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> -
@Martian the
commentExpris incorrect.FYI PR #2602 - FunctionList Update 2 includes an AutoIt3 parser.
-
@MAPJe71 said:
@Martian the
commentExpris incorrect.FYI PR #2602 - FunctionList Update 2 includes an AutoIt3 parser.
Thank you MAPJe71
I meant it to be in the official Notepad ++ installer
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login