help-global
[Top][All Lists]
Advanced

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

Re: RegExp in Find Definition


From: Shigio YAMAGUCHI
Subject: Re: RegExp in Find Definition
Date: Fri, 17 Apr 2015 23:08:31 +0900

Hi,
> 2) I run "global -dx tags." - below is the output:
...
> I would expect that only
>
> tagsearch
>
> would be a valid match as it seems the only definition that matches the given regexp.

Please use '^' (match to the head).

$ global -dx '^tags'

> 3) If I run "global -dx .tags" I get:
...
> Same as above, I would expect that only
...
> gtagsexist
> htags_load_filemap

Please try the following command line:

$ global -dx '^.tags'

> 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()
...
> global -dx tags_.
>
> should match only the first. To match the second I would need to do

Please use '$' (match to the end).

$ global -dx '^tags_.$'

> To match both perhaps I would do
>
> global -dx tags_.*

$ global -dx '^tags_.'

Good luck!

Regards,
Shigio


2015-04-17 20:30 GMT+09:00 Pavel Nedev <address@hidden>:
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

_______________________________________________
Help-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-global



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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