--- ctags-5.5.4/php.c	2004-02-18 06:30:11.000000000 +0100
+++ php.c	2005-03-13 19:10:02.495928704 +0100
@@ -28,14 +28,15 @@
 *   DATA DEFINITIONS
 */
 typedef enum {
-    K_CLASS, K_DEFINE, K_FUNCTION, K_VARIABLE
+    K_CLASS, K_DEFINE, K_FUNCTION, K_VARIABLE, K_FILE
 } phpKind;
 
 static kindOption PhpKinds [] = {
     { TRUE, 'c', "class",    "classes" },
     { TRUE, 'd', "define",   "constant definitions" },
     { TRUE, 'f', "function", "functions" },
-    { TRUE, 'v', "variable", "variables" }
+    { TRUE, 'v', "variable", "variables" },
+    { TRUE, 'r', "required files", "required files" }
 };
 
 /*
@@ -57,6 +58,57 @@
     return (boolean)(isVarChar1 (c) || isdigit (c));
 }
 
+static void setFunctionName(const char *cp, int num, vString *name) 
+{
+    cp += num;
+    
+    while (isspace ((int) *cp))
+        ++cp;
+    
+    if (*cp == '&') /* skip reference character */
+        cp++;
+    
+    vStringClear (name);
+    while (isalnum ((int) *cp)  ||  *cp == '_')
+    {
+        vStringPut (name, (int) *cp);
+        ++cp;
+    }
+    vStringTerminate (name);
+    makeSimpleTag (name, PhpKinds, K_FUNCTION);
+    vStringClear (name);
+}
+
+static void setRequiredFileName(const char *cp, int num, vString *name) 
+{
+    cp += num;
+    
+    while (isspace ((int) *cp))
+        ++cp;
+    if (*cp != '(')
+        /*continue;*/
+    return;
+    ++cp;
+    
+    while (isspace ((int) *cp))
+        ++cp;
+    if ((*cp == '\'') || (*cp == '"'))
+        ++cp;
+    else if (! ((*cp == '_')  || isalnum ((int) *cp)))
+        /* continue; */
+    return;
+    
+    vStringClear (name);
+    while (isalnum ((int) *cp)  ||  *cp == '_' || *cp == '/' || *cp == '.')
+    {
+        vStringPut (name, (int) *cp);
+        ++cp;
+    }
+    vStringTerminate (name);
+    makeSimpleTag (name, PhpKinds, K_FILE);
+    vStringClear (name);
+}
+
 static void findPhpTags (void)
 {
     vString *name = vStringNew ();
@@ -87,27 +139,62 @@
 		vStringClear (name);
 	    }
 	}
+        
 	else if (strncmp ((const char*) cp, "function", (size_t) 8) == 0  &&
 	    isspace ((int) cp [8]))
 	{
-	    cp += 8;
+            setFunctionName(cp, 8, name);
+        } 
 
-	    while (isspace ((int) *cp))
-		++cp;
+        /* Public functions */
+        else if (strncmp ((const char*) cp, "public function", (size_t) 15) == 0  &&
+            isspace ((int) cp [15]))
+        {
+            setFunctionName(cp, 15, name);
+        } 
 
-	    if (*cp == '&')	/* skip reference character */
-		cp++;
+        /* Protected functions */
+        else if (strncmp ((const char*) cp, "protected function", (size_t) 18) == 0  &&
+            isspace ((int) cp [18]))
+        {
+            setFunctionName(cp, 18, name);
+        } 
 
-	    vStringClear (name);
-	    while (isalnum ((int) *cp)  ||  *cp == '_')
+        /* Private functions */
+        else if (strncmp ((const char*) cp, "private function", (size_t) 16) == 0  &&
+            isspace ((int) cp [16]))
 	    {
-		vStringPut (name, (int) *cp);
-		++cp;
+            setFunctionName(cp, 16, name);
 	    }
-	    vStringTerminate (name);
-	    makeSimpleTag (name, PhpKinds, K_FUNCTION);
-	    vStringClear (name);
+        
+        /* Required file */
+        else if (strncmp ((const char*) cp, "require", (size_t) 7) == 0 &&
+            ! isalnum ((int) cp [7]) && cp [7] != '_')
+        {
+            setRequiredFileName(cp, 7, name);       
 	} 
+        
+        /* Required file */
+        else if (strncmp ((const char*) cp, "require_once", (size_t) 12) == 0 &&
+            ! isalnum ((int) cp [12]))
+        {
+            setRequiredFileName(cp, 12, name);      
+        }
+        
+        /* Required file */
+        else if (strncmp ((const char*) cp, "include", (size_t) 7) == 0 &&
+            ! isalnum ((int) cp [7]) && cp [7] != '_')
+        {
+            setRequiredFileName(cp, 7, name);       
+        }
+        
+        /* Required file */
+        else if (strncmp ((const char*) cp, "include_once", (size_t) 12) == 0 &&
+            ! isalnum ((int) cp [12]))
+        {
+            setRequiredFileName(cp, 12, name);      
+        }
+        
 	else if (strncmp ((const char*) cp, "class", (size_t) 5) == 0 &&
 		 isspace ((int) cp [5]))
 	{
