Functionlist parsing issues, language specifics.
-
Updated to NPP 8.4.8. Same problems.
1). how to turn on and off the global regular expression flag since lookahead positive is affected by it? There doesn’t seem to be a specific inline mode capability to do this nor a code to tell the parser what to do.
2). My functionlist language (C like) works on the online regex101 test site for PCRE2. However, when copied to the functionlist language file I’m writing, it just hangs as not responding. I realize that NPP specifies boost and even the current npp is one version behind. Since boost is having problems and PCRE2 isn’t (since I can’t test online against boost), I’d like to see the ability that one can select in a configuration file any of the popular reg expression tools out there. I already know that the C parser distributed with npp has hanging issues too with boost. Considering the amount of time it takes to get a parser working, one doesn’t have the time to workaround ie. boot’s issues.
3). since one writes code for various languages such as C, java, javascript, tcl etc, each of these languages have their own regular expression implementation with their own quirks/limitations. Thus, If one is writing a functionlist parser for their language, it would be great if one can select the specific reg expression tool to parse ones code that the language itself would use. I.E. if writing TCL one selects the reg expression tool that TCL utilizes which wouldn’t be boost. Hence one wouldn’t utilize features in the funtionlist that are incompatible with TCL’s reg expression language etc.
4). In the early part of writing my functionlist parser when it was simplier, I had copied the function list reg expression code to the function name section and it seems to works (although later versions cause boost to hang). The documentation from what I understand doesn’t state how the function list parser section does preprocessing and I presume filtering the list down and how this info is passed to the function name section for any further filtering. Thus, my reason for just making both the same except for commenting out the last step that would display the opening bracket { of a function definition.) Moreover since an if,while, and a for statement looks the same as a function definition, there is no reason for one not to have the function list display every if/while/for statement. NPP could add a feature to separate these statement types so if one wants to jump to something that isn’t a function, one could i.e. jump to any if statement that are group together as such, likewise for any of the other statement types. So the functionlist could be changed as:
function tree
if tree
while tree
for treeetc clicking any of these would expand the coresponding tree to show the corresponding statements.
5). In an earlier question I had asked if a function when spread across multiple lines if functionlist would display it. It will display only the first line (the answer was no). Sometimes function parameters can be alot and one would need to scroll to the right to see the complete list. However, when spread across multiple lines, NPP could be modified such that when one puts the cursor on the function before clicking it, that a popup could be shown to show the complete multiline definition as was written, then when clicked, take one to that position in the code. My parser can handle the multiline definition if written that way, but NPP will only display the first line in the simplier parser that worked (but the expanded version causes boost to hang).
-
I think making the developers support multiple regex engines, having to compile them all in to Notwpad++, and making the developers keep the engines updated, and having different FunctionList files using different syntax , and making the forum regulars have to answer questions about all those possible engines is an absolutely horrible “solution” to your problem.
After reading all these ideas/complaints, I really think you would be better served by one of the “tags” style code-navigation plugins, one of which maybe better suited to solving more or all of your needs (and which might help with multi-file navigation, which you haven’t mentioned yet but which you may have brought up eventually), rather than the generic FunctionList feature, which was designed to give a simple interface for listing the names of functions and classes in a single file.
-
@PeterJones said in Functionlist parsing issues, language specifics.:
you would be better served by one of the “tags” style code-navigation plugins
There’s some info on some good ones HERE; see the Dec 22, 2022 12:41pm posting.
-
Putting this as delicately as I can, when I was developing my UDL, I ran into the same problem. Solution: Do it the way the functionList regex(boost) does it. Which means, learn the boost or rather, the NPP way of doing it. Stop trying to compare apples and oranges to get what you want done by insisting on shoehorning some other tool into it.
Regex101.com is a great resource for someone learning regex and trying things out to interactively see how different combinations help to achieve results…but since they even have mutiple ‘flavors’ of regex, that should tell you something right there. There is no one only option. You take the good with the bad…and in this case, they don’t offer their site with a boost version. Unfortunately for you, they also don’t write Notepad++, and currently, NPP uses the Boost regex engine for whatever reason the developers chose to use it. Since Regex101.com doesn’t offer you a way to write a functionList for NPP…you’re stuck having to learn the tool this tool chose to use or forego the tool.
I get it, it was a setback for me also and I had to learn to use the NPP/Boost, and I had a lot of help from these folks here on how to get it to work to do what I wanted, but that’s because they’re familiar with this tool, using these tools, and have developed similar things also. So…best advise, is to buckle down and start using the present tools, rather than dream of a perfect world. :) No sense wishing, when you can make a suggstion for future use, but presently use and learn the tools available. I’m still a newbie regex user, and regex101.com is my choice for interactive development of a regex, but at the end of the day, it helps me get 90% of the way there, but I still have to finish it in Boost…so…I do.
Happy New Year to you and all the fine folks here who are willing to help you use the tools available NOW. :)