mapa4, You're welcome.
I really thought that last version worked, it seems to work for me without skipping now. Maybe you checked before I made the edits?
Noesis,
I think you are right it is annoying and I took your suggestion and used it in the parser, with a slight change
(?!(if\(|while\(|for\()) will stop cases where the line starts with
if while for, and is immediately followed by the open parenthesis from matching, while allowing if there is other text between to still match. Thank you very much.
Code: Select all
<parser id="ahk_function" displayName="AHK" commentExpr="(\/\*[\s+\w+\n]{1,}\*\/)|(^;[\s+\w+]{1,})">
<!-- AutoHotKey Function List -->
<classRange
mainExpr="^[\t ]*(class|struct)[\t ]+[\w]+([\t ]+|[\t ]+(extends)[\s]+(\,[\t ]*|(\\|[\w][\w]*))+[\s]*)?([\s\t]+;.*?[\r\n]+\{|[\s\t\r\n]*\{)"
openSymbole = "\{"
closeSymbole = "\}"
displayMode="node">
<className>
<nameExpr expr="(class|struct)[\t ]+[\w]+"/>
<nameExpr expr="[\t ]+[\w]+"/>
<nameExpr expr="[\w]+"/>
</className>
<function
mainExpr="^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_])+\d*\([\w+:=\d\s,"#.]*\)([\s\t]+;.*?[\r\n]+\{|[\s\t\r\n]*\{)|^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_])+\d*:(?=([\s\t]*[\r\n]|[\s\t]+;.*[\r\n]))|^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_: ])+\d*(?<![ ])::(?=[^\r\n\t\s])?">
<functionName>
<funcNameExpr expr="([a-zA-Z0-9#!^+&<>*~$_])+\d*\([\w+:=\d\s,"#.]*\)|([a-zA-Z0-9#!^+&<>*~$_: ])+\d*::?"/>
</functionName>
</function>
</classRange>
<function
mainExpr="^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_])+\d*\([\w+:=\d\s,"#.]*\)([\s\t]+;.*?[\r\n]+\{|[\s\t\r\n]*\{)|^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_])+\d*:(?=([\s\t]*[\r\n]|[\s\t]+;.*[\r\n]))|^[\t ]*(?!(if\(|while\(|for\())([a-zA-Z0-9#!^+&<>*~$_: ])+\d*(?<![ ])::(?=[^\r\n\t\s])?"
displayMode="$className->$functionName">
<functionName>
<nameExpr expr="([a-zA-Z0-9#!^+&<>*~$_])+\d*\([\w+:=\d\s,"#.]*\)|([a-zA-Z0-9#!^+&<>*~$_: ])+\d*::?"/>
</functionName>
</function>
</parser>
*EDIT*
Above parser code also applies the comment fix to class names, so cases where there is a comment after a class declaration but before the open bracket should be fixed as well.
*EDIT2*
A bug I just noticed when testing above class fixes, there needs to be a new line after the closing bracket (
} ) of a class. Not sure this is a problem I'll look into much, since it should be easy to just add a new line to the end of any file.