The function list and the ability to navigate up or down in a file by function is great.
I assume by this you mean the
View, Next and Prevous Functions menu items. I agree entirely and personal uses this feature of Zeus most of all
How about allowing these features to work with C++ operations? I assume it wouldn't be too hard since the "Functions" tagged in the navigator pane shows C and C++ routines.
As you have found the
Functions List does not tie up with the function navigation feature. The reasons for this are historic, and basically relate to the fact that function navigation was one of the first features added to Zeus will the ctags function list is one of the last
But having said that, it is also possible to re-configure Zeus to work this way
First some background. The function navigation is tied directly to the
Functions Regexp found in the
General of the document type
Document Type. To better understand how this works try the following:
- Edit C/C++ Document type
- Gi to the General section
- Enter test as the Functions Regexp
Zeus has now been configure so that only lines containing the word
test are recognised as functions. Now this is not much good to anyone, but it does give an idea on how this feature works
What happens is when no
Functions Regexp is defined, Zeus uses the a set of default c/c++ regexps but when a
Functions Regexp is is provided these default regexps are no longer used.
So back to the original question of making these features work for operators functions. To make this work just requires the creation of a new regexp to identify functions. For most languages this is quite easy since they use some sort of
function or
procedure keyword but for c/c++ it is a little harder.
These are the default c/c++ Zeus regular expressions:
Code: Select all
#define REGEXP_C_FUNC_WITH_RETURN "^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$"
#define REGEXP_CPP_CTOR_OR_DTOR "^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$"
#define REGEXP_CPP_FUNC_WITH_RETURN "^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$"
To define a suitable users regexp a good starting point would be to combine these three regular expressions using the
()|() or logic to come up with the following regexp:
Code: Select all
(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
To test this regular expression, open a c/c++ source file, use the
Edit, Find menu and run a search using this regular expression. As you repeat the
Find every line that is found represents a function. You should observe that the lines containg the operator functions do not get found by this regexp, naturally
Thus all that remains is to modify the regexp to also find these operation functions. Then re-edit the document type adding in the new regexp. I can not help you with this last bit since for me the regexp does find the operator function that I used as a test. But if you post a short snippet of the operator function that is failing I will post a new regexp to fix the problem.
Finally, notice how this means you could extend the function navigation to also include the header files. For example this new regexp:
Code: Select all
(^class)|(^struct)|(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
extends the navigation to also work for classes and structures.
Cheers Jussi