Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 15 Apr 2013 16:51:26 UTC Commit: bdb98f0132af9b50e73a920d4856fe1f821fd185 https://github.com/geany/geany/commit/bdb98f0132af9b50e73a920d4856fe1f821fd1...
Log Message: ----------- PHP: fix parsing of functions returning a reference
Fix parsing of functions declarations with a leading ampersand (&), used to make the function return a reference:
function &foo($arg1, $arg2) { /* ... */ }
Modified Paths: -------------- tagmanager/ctags/php.c
Modified: tagmanager/ctags/php.c 10 files changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -199,7 +199,8 @@ TOKEN_EQUAL_SIGN, TOKEN_OPEN_SQUARE, TOKEN_CLOSE_SQUARE, - TOKEN_VARIABLE + TOKEN_VARIABLE, + TOKEN_AMPERSAND } tokenType;
typedef struct { @@ -567,6 +568,7 @@ static void readToken (tokenInfo *const token) case '}': token->type = TOKEN_CLOSE_CURLY; break; case '[': token->type = TOKEN_OPEN_SQUARE; break; case ']': token->type = TOKEN_CLOSE_SQUARE; break; + case '&': token->type = TOKEN_AMPERSAND; break;
case '=': { @@ -740,6 +742,9 @@ static boolean parseClassOrIface (tokenInfo *const token, phpKind kind) return readNext; }
+/* parse a function + * function myfunc($foo, $bar) {} + * function &myfunc($foo, $bar) {} */ static boolean parseFunction (tokenInfo *const token) { boolean readNext = TRUE; @@ -748,6 +753,9 @@ static boolean parseFunction (tokenInfo *const token) tokenInfo *name;
readToken (token); + /* skip a possible leading ampersand (return by reference) */ + if (token->type == TOKEN_AMPERSAND) + readToken (token); if (token->type != TOKEN_IDENTIFIER) return FALSE;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).