[Feature/Help Request] Add more items to function list for Windows batch files
currently the function list shows only labels (:name) for batch files. I additionally need these items:
My request is to have these items added to functionlist.xml.
Can someone help my with the code to do so myself in the meantime?
Thank you very much.
I strongly advise against showing more then just functions/sub-routines (i.e. labels in batch files) in the FunctionList tree but considering the following …
CALL [drive:][path]filename [batch-parameters] CALL :label arguments START ["title"] [start-arguments] [command/program] [parameters] GOTO [:]label
… what parts of the commands would you like to show up in the tree?
To fully distinguish the different GOTO, CALL and START commands, of your batch file, I suppose that you need all the contents of the line, starting with these commands :-)
If so, here is, below, a batch parser, which should work nice !!
Open your active functionList.xml file
Change the present batch_label id parser contents by the parser, below :
<parser id=“batch_label” displayName=“BAT Label” commentExpr=“^[\t ](::|REM).?$”>
<nameExpr expr=“(call |goto |start |(?<=:)).+?$”/>
The commentExpr string is, either, the word
REMor the symbol
::, preceded by possible leading space/tabulation characters and followed by any range, even null, or characters
mainExprstring, from which the different entities, to display in the FunctionList window, will be extracted, is any, non-null, range of characters, which follows possible leading space/tabulation characters ( and different from comment ranges ! )
exprstring is, either :
- The word call, goto or start, followed by a space and any non null range of characters
- Any non null range of characters, following a colon (
The functionList regex engine does NOT act as the Notepad++ one. By default, it considers that the dot meta-character (
.) match, absolutely, any character ( standard or EOL ones )
But, as the Notepad++ regex engine does, it considers that the
$assertions stand for the beginning and the end of any line
So, when you want to match, from any location, all the remaining characters of a line, TWO syntaxes are possible :
.+?$which matches any non-null range of any character, ( standard or EOL ones ), till the nearest EOL location, due to the lazy quantifier
(?-s).+which matches any non-null range of standard characters only, due to the in-line modifier
Of course, if the range of characters may be a zero-length string, prefer the syntax