help-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegExp in Find Definition


From: Pavel Nedev
Subject: Re: RegExp in Find Definition
Date: Fri, 17 Apr 2015 14:30:48 +0300 (EEST)

My reasoning behind this is that Grep regexp match is OK -> it matches anything 
that corresponds to the given pattern without limiting to a single whole 
identifier,
while Definition and Reference searches should have identifier boundaries.

If I have both definitions

void tags_1()
int tags_123()

the search

global -gx tags_.

would match both, but

global -dx tags_.

should match only the first. To match the second I would need to do

global -dx tags_...

To match both perhaps I would do

global -dx tags_.*

That mail thread become quite long, sorry for that. I just wanted to make my 
idea clear.

Thank you,
Pavel



>-------- Оригинално писмо -------- 
>От: Pavel Nedev address@hidden 
>Относно: Re: RegExp in Find Definition 
>До: Pavel Nedev <address@hidden> 
>Изпратено на: 17.04.2015 14:17 


> And once again, the same is valid for example 2) also - "global -dx tags." 
> 
> global -dx tags. 
> 
> should match for example 
> 
> tags1, tagsx, tagsN.... 
> 
> and shouldn't match 
> 
> tags_new, tagsRE, gtags, htags2.... 
> 
> Best Regards, 
> Pavel 
> 
> 
> 
> >-------- Оригинално писмо -------- 
> >От: Pavel Nedev address@hidden 
> >Относно: Re: RegExp in Find Definition 
> >До: Pavel Nedev 
> >Изпратено на: 17.04.2015 14:13 
> 
> 
> > Sorry, one mistake: 
> > 
> > for use case 3) "global -dx .tags" 
> > 
> > I would actually expect to get no results at all as ".tags" as I understand 
> > it should filter only definitions that start with any valid char for 
> > identifier ('_', 'a'-'z',... etc.) and ending with "tags". For example: 
> > 
> > gtags, htags, _tags are valid 
> > rxtags, tags, gtags_new are not valid. 
> > 
> > Best Regards, 
> > Pavel 
> > 
> > 
> > 
> > >-------- Оригинално писмо -------- 
> > >От: Pavel Nedev address@hidden 
> > >Относно: RegExp in Find Definition 
> > >До: address@hidden 
> > >Изпратено на: 17.04.2015 14:08 
> > 
> > 
> > > Hi, 
> > > 
> > > I have a question regarding regexp usage in find definition (valid for 
> > > finding reference also). 
> > > 
> > > Here is the use case: 
> > > 1) I create global database on global 6.4 sources with "gtags -c" 
> > > 2) I run "global -dx tags." - below is the output: 
> > > 
> > > gtags_close       951 libutil/gtagsop.c gtags_close(GTOP *gtop) 
> > > gtags_delete      553 libutil/gtagsop.c gtags_delete(GTOP *gtop, IDSET 
> > > *deleteset) 
> > > gtags_first       681 libutil/gtagsop.c gtags_first(GTOP *gtop, const 
> > > char *pattern, int flags) 
> > > gtags_flush       539 libutil/gtagsop.c gtags_flush(GTOP *gtop, const 
> > > char *fid) 
> > > gtags_next        892 libutil/gtagsop.c gtags_next(GTOP *gtop) 
> > > gtags_open        330 libutil/gtagsop.c gtags_open(const char *dbpath, 
> > > const char *root, int db, int mode, int flags) 
> > > gtags_put_using   480 libutil/gtagsop.c gtags_put_using(GTOP *gtop, const 
> > > char *tag, int lno, const char *fid, const char *img) 
> > > gtags_restart     644 libutil/gtagsop.c gtags_restart(GTOP *gtop) 
> > > gtags_show_statistics  940 libutil/gtagsop.c gtags_show_statistics(GTOP 
> > > *gtop) 
> > > gtagsexist        142 libutil/getdbpath.c gtagsexist(const char 
> > > *candidate, char *dbpath, int size, int verbose) 
> > > htags_load_filemap  218 htags-refkit/htags_path2url.c 
> > > htags_load_filemap(const char *filemap) 
> > > htags_path2url    266 htags-refkit/htags_path2url.c htags_path2url(const 
> > > char *path, int line, char *url, int size) 
> > > htags_unload_filemap  242 htags-refkit/htags_path2url.c 
> > > htags_unload_filemap(void) 
> > > tagsearch        1733 global/global.c  tagsearch(const char *pattern, 
> > > const char *cwd, const char *root, const char *dbpath, int db) 
> > > 
> > > I would expect that only 
> > > 
> > > tagsearch        1733 global/global.c  tagsearch(const char *pattern, 
> > > const char *cwd, const char *root, const char *dbpath, int db) 
> > > 
> > > would be a valid match as it seems the only definition that matches the 
> > > given regexp. 
> > > 
> > > 3) If I run "global -dx .tags" I get: 
> > > 
> > > compare_tags       92 libutil/gtagsop.c compare_tags(const void *v1, 
> > > const void *v2) 
> > > completion_tags   942 global/global.c  completion_tags(const char 
> > > *dbpath, const char *root, const char *prefix, int db) 
> > > createtags        888 gtags/gtags.c    createtags(const char *dbpath, 
> > > const char *root) 
> > > gtags_close       951 libutil/gtagsop.c gtags_close(GTOP *gtop) 
> > > gtags_delete      553 libutil/gtagsop.c gtags_delete(GTOP *gtop, IDSET 
> > > *deleteset) 
> > > gtags_first       681 libutil/gtagsop.c gtags_first(GTOP *gtop, const 
> > > char *pattern, int flags) 
> > > gtags_flush       539 libutil/gtagsop.c gtags_flush(GTOP *gtop, const 
> > > char *fid) 
> > > gtags_next        892 libutil/gtagsop.c gtags_next(GTOP *gtop) 
> > > gtags_open        330 libutil/gtagsop.c gtags_open(const char *dbpath, 
> > > const char *root, int db, int mode, int flags) 
> > > gtags_put_using   480 libutil/gtagsop.c gtags_put_using(GTOP *gtop, const 
> > > char *tag, int lno, const char *fid, const char *img) 
> > > gtags_restart     644 libutil/gtagsop.c gtags_restart(GTOP *gtop) 
> > > gtags_show_statistics  940 libutil/gtagsop.c gtags_show_statistics(GTOP 
> > > *gtop) 
> > > gtagsexist        142 libutil/getdbpath.c gtagsexist(const char 
> > > *candidate, char *dbpath, int size, int verbose) 
> > > htags_load_filemap  218 htags-refkit/htags_path2url.c 
> > > htags_load_filemap(const char *filemap) 
> > > htags_path2url    266 htags-refkit/htags_path2url.c htags_path2url(const 
> > > char *path, int line, char *url, int size) 
> > > htags_unload_filemap  242 htags-refkit/htags_path2url.c 
> > > htags_unload_filemap(void) 
> > > start_ctags        92 plugin-factory/exuberant-ctags.c start_ctags(const 
> > > struct parser_param *param) 
> > > start_ctags       161 plugin-factory/exuberant-ctags.c start_ctags(const 
> > > struct parser_param *param) 
> > > terminate_ctags   136 plugin-factory/exuberant-ctags.c 
> > > terminate_ctags(void) { 
> > > terminate_ctags   206 plugin-factory/exuberant-ctags.c 
> > > terminate_ctags(void) 
> > > updatetags        799 gtags/gtags.c    updatetags(const char *dbpath, 
> > > const char *root, IDSET *deleteset, STRBUF *addlist) 
> > > 
> > > Same as above, I would expect that only 
> > > 
> > > gtags_close       951 libutil/gtagsop.c gtags_close(GTOP *gtop) 
> > > gtags_delete      553 libutil/gtagsop.c gtags_delete(GTOP *gtop, IDSET 
> > > *deleteset) 
> > > gtags_first       681 libutil/gtagsop.c gtags_first(GTOP *gtop, const 
> > > char *pattern, int flags) 
> > > gtags_flush       539 libutil/gtagsop.c gtags_flush(GTOP *gtop, const 
> > > char *fid) 
> > > gtags_next        892 libutil/gtagsop.c gtags_next(GTOP *gtop) 
> > > gtags_open        330 libutil/gtagsop.c gtags_open(const char *dbpath, 
> > > const char *root, int db, int mode, int flags) 
> > > gtags_put_using   480 libutil/gtagsop.c gtags_put_using(GTOP *gtop, const 
> > > char *tag, int lno, const char *fid, const char *img) 
> > > gtags_restart     644 libutil/gtagsop.c gtags_restart(GTOP *gtop) 
> > > gtags_show_statistics  940 libutil/gtagsop.c gtags_show_statistics(GTOP 
> > > *gtop) 
> > > gtagsexist        142 libutil/getdbpath.c gtagsexist(const char 
> > > *candidate, char *dbpath, int size, int verbose) 
> > > htags_load_filemap  218 htags-refkit/htags_path2url.c 
> > > htags_load_filemap(const char *filemap) 
> > > htags_path2url    266 htags-refkit/htags_path2url.c htags_path2url(const 
> > > char *path, int line, char *url, int size) 
> > > htags_unload_filemap  242 htags-refkit/htags_path2url.c 
> > > htags_unload_filemap(void) 
> > > 
> > > are shown as the regexp ".tags" matches only these. 
> > > 
> > > Same is observed with finding references also. 
> > > 
> > > Am I missing something? 
> > > 
> > > Thanks, 
> > > Best Regards, 
> > > Pavel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]