bug-global
[Top][All Lists]
Advanced

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

Re: gtags and ctags like --regex support


From: Aneesh Kumar
Subject: Re: gtags and ctags like --regex support
Date: Sun, 21 Jun 2009 16:18:12 +0530

On Sun, Jun 21, 2009 at 12:11 PM, Aneesh Kumar<address@hidden> wrote:
> On Sun, Jun 21, 2009 at 6:44 AM, Shigio YAMAGUCHI<address@hidden> wrote:
>> Hi,
>>> Is there a way i can make gtags makes tags based on the regex matching
>>> in addition to the tags made with the standard parsing based on
>>> language ?
>>> What i wanted to achive is to  use something like
>>> --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'
>>> That would help me have tag data generated with name like
>>> sys_fallocate where in the code it will appear
>>> as SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
>>
>> This kind of option is available in Exuberant Ctags.
>> You can use Exuberant Ctag as a parser for GLOBAL.
>> (It cannot make GRTAGS and GSYMS files though.)
>> Please see the section 'Plug-in parser' in the info manual and
>> gtags.conf file.
>>
>> However, it might be quicker to rewrite gtags-parser/C.c directly.
>> You can refer the code for recognizing Guile function entries (SCM_DEFINE).
>>
>
> I did that and it mostly works. But the linux kernel have complex
> indirection like
> SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
> which it doesn't match.
>
> it works for SYSCALL_DEFINE3(open, const char __user *, filename, int,
> flags, int, mode)
>
>

The change below make the above function definition recognized. Not
sure what is the patter ';' and ',' is trying to match. So the change
may be really bogus.

@@ -609,11 +618,11 @@ function_definition(int target, char arg
                }
        }
        if (c == EOF)
                return 0;
        brace_level = 0;
-       while ((c = nexttoken(",;[](){}=", c_reserved_word)) != EOF) {
+       while ((c = nexttoken("[](){}=", c_reserved_word)) != EOF) {
                switch (c) {
                case SHARP_IFDEF:
                case SHARP_IFNDEF:
                case SHARP_IF:
                case SHARP_ELIF:

-aneesh




reply via email to

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