From 258c4fa65d7dc154e0da0c8b29eaf874af4f166e Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 9 Apr 2013 23:07:14 +0200 Subject: [PATCH] PHP: generate tags for local variables (disabled by default) --- tagmanager/ctags/php.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tagmanager/ctags/php.c b/tagmanager/ctags/php.c index 45d289466..248470232 100644 --- a/tagmanager/ctags/php.c +++ b/tagmanager/ctags/php.c @@ -100,6 +100,7 @@ typedef enum { K_DEFINE, K_FUNCTION, K_INTERFACE, + K_LOCAL_VARIABLE, K_VARIABLE, COUNT_KIND } phpKind; @@ -109,6 +110,7 @@ static kindOption PhpKinds[COUNT_KIND] = { { TRUE, 'm', "macro", "constant definitions" }, { TRUE, 'f', "function", "functions" }, { TRUE, 'i', "interface", "interfaces" }, + { FALSE, 'l', "local", "local variables" }, { TRUE, 'v', "variable", "variables" } }; @@ -885,18 +887,21 @@ static boolean parseVariable (tokenInfo *const token) boolean readNext = TRUE; accessType access = CurrentStatement.access; - /* don't generate variable tags inside functions */ - if (token->parentKind == K_FUNCTION) - return TRUE; - name = newToken (); copyToken (name, token, TRUE); readToken (token); if (token->type == TOKEN_EQUAL_SIGN) { + phpKind kind = K_VARIABLE; + + if (token->parentKind == K_FUNCTION) + kind = K_LOCAL_VARIABLE; + readToken (token); - if (token->type == TOKEN_KEYWORD && token->keyword == KEYWORD_function) + if (token->type == TOKEN_KEYWORD && + token->keyword == KEYWORD_function && + PhpKinds[kind].enabled) { if (parseFunction (token, name)) readToken (token); @@ -904,7 +909,7 @@ static boolean parseVariable (tokenInfo *const token) } else { - makeSimplePhpTag (name, K_VARIABLE, access); + makeSimplePhpTag (name, kind, access); readNext = FALSE; } } -- 2.11.4.GIT