[geany/geany] 23339d: PHP: report class inheritance
Colomban Wendling
git-noreply at xxxxx
Wed Jul 3 17:41:57 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 15 Apr 2013 16:43:22 UTC
Commit: 23339dd509947f8e4322793580943607d4a77fc4
https://github.com/geany/geany/commit/23339dd509947f8e4322793580943607d4a77fc4
Log Message:
-----------
PHP: report class inheritance
Modified Paths:
--------------
tagmanager/ctags/php.c
Modified: tagmanager/ctags/php.c
20 files changed, 17 insertions(+), 3 deletions(-)
===================================================================
@@ -289,7 +289,7 @@ static void makeSimplePhpTag (tokenInfo *const token, phpKind kind, accessType a
}
}
-static void makeClassTag (tokenInfo *const token, implType impl)
+static void makeClassTag (tokenInfo *const token, vString *const inheritance, implType impl)
{
if (PhpKinds[K_CLASS].enabled)
{
@@ -299,6 +299,8 @@ static void makeClassTag (tokenInfo *const token, implType impl)
if (impl != IMPL_UNDEFINED)
e.extensionFields.implementation = implToString (impl);
+ if (vStringLength (inheritance) > 0)
+ e.extensionFields.inheritance = vStringValue (inheritance);
makeTagEntry (&e);
}
@@ -690,6 +692,7 @@ static boolean parseClass (tokenInfo *const token)
boolean readNext = TRUE;
implType impl = CurrentStatement.impl;
tokenInfo *name;
+ vString *inheritance = NULL;
readToken (token);
if (token->type != TOKEN_IDENTIFIER)
@@ -697,22 +700,33 @@ static boolean parseClass (tokenInfo *const token)
name = newToken ();
copyToken (name, token, TRUE);
- makeClassTag (name, impl);
- /* skip over possible "extends FOO, BAR" */
+ inheritance = vStringNew ();
+ /* skip until the open bracket and assume every identifier (not keyword)
+ * is an inheritance (like in "class Foo extends Bar implements iA, iB") */
do
{
readToken (token);
+
+ if (token->type == TOKEN_IDENTIFIER)
+ {
+ if (vStringLength (inheritance) > 0)
+ vStringPut (inheritance, ',');
+ vStringCat (inheritance, token->string);
+ }
}
while (token->type != TOKEN_EOF &&
token->type != TOKEN_OPEN_CURLY);
+ makeClassTag (name, inheritance, impl);
+
if (token->type == TOKEN_OPEN_CURLY)
enterScope (token, name->string, K_CLASS);
else
readNext = FALSE;
deleteToken (name);
+ vStringDelete (inheritance);
return readNext;
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list