@cousteaulecommandant thanks for the analysis, couple of comments/suggestions
Then again, it doesn't deal with comments that may be problematic in certain scenarios.
This is more a note to me and @techee than you, we do need to be careful of theoretical situations and perfection, the most likely case for problems is slabs of commented out code, and maybe its tolerable for symbols to be parsed in that situation. Then again if comments can be detected by a regex early in the list it has the ability to skip further scanning of those line(s) which would avoid the problem.
It also parses variables (not just structs assigned with the struct() function as Geany does), but I think that's overkill since it'll catch EVERY assignment to a variable.
Ahh, another "assignment is declaration" language, the Python parser catches every assignment IIRC, but then again the Julia one does not, so either seems to be acceptable to users.
I really should implement a timing function to answer this; it would be quite helpful for deciding.
What you need is a big matlab file (IIUC they are mostly teeny, again making regex performance irrelevant) your Terabyte matlab model controlling the known universe should do ;-).
Ctags has the --totals=extra
option that prints bytes per second scanning so scan a big C++ file (Scintilla Editor.cxx from this repository is ~8800 lines for eg) and your big matlab file and compare them. For Geany time geany -g tags_file your_big_matlab_file.m
and the C++ file again but you will have to do the math yourself to get bytes per second.
Your analysis of the difficulty of adding start()
and stop()
and properties etc to a class looks right to me.
"line-oriented parser, with something that remembers the last declared class"
The scope stack functionality that ctags provides for optlib (regex) implementations is supposed to support that, except with matlab you have the scope classdef Motor but inside that you have scope properties
and events
and methods
, but AFAICT the ctags scope only allows access to top of stack, so you can't access the classdef
scope that you want to make the method tags a member of because it isn't on top of stack, properties
, events
or methods
is, but I can't see how the tag kind can depend on that and the scope depend on the classdef. But maybe I'm missing something @techee heeeeeeeelp (appeal to the real Geany ctags expert)?
Detecting end
then pops the stack, so that would work, so long as every construct that has end
gets a scope pushed on the stack it then doesn't matter which one end
pops.
And as you point out properties
can be a list of names, and so can events
so thats another context that the tag has to depend on.
To summarise my last ramblings, unless we can identify how the regex parser can handle matlab context and scoping we have to conclude that it can't be expanded to do that, suggesting that adding the same naive classdef
to the Geany parser and pushing it upstream will not lose ctags functionality and is better in the long run since it can support scoping in the future.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.