Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 132880 | Differences between
and this patch

Collapse All | Expand All

(-)php.c (-4 / +50 lines)
Lines 42-47 Link Here
42
*   FUNCTION DEFINITIONS
42
*   FUNCTION DEFINITIONS
43
*/
43
*/
44
44
45
/* JavaScript patterns are duplicated in jscript.c */
46
47
static void installPHPRegex (const langType language)
48
{
49
	addTagRegex(language, "(^|[ \t])class[ \t]+([A-Za-z\x7F-\xFF_][0-9A-Za-z\x7F-\xFF_]*)",
50
		"\\2", "c,class,classes", NULL);
51
	addTagRegex(language, "(^|[ \t])interface[ \t]+([A-Za-z\x7F-\xFF_][0-9A-Za-z\x7F-\xFF_]*)",
52
		"\\2", "i,interface,interfaces", NULL);
53
	addTagRegex(language, "(^|[ \t])define[ \t]*\\([ \t]*['\"]?([A-Za-z\x7F-\xFF_][0-9A-Za-z\x7F-\xFF_]*)",
54
		"\\2", "d,define,constant definitions", NULL);
55
	addTagRegex(language, "(^|[ \t])function[ \t]+&?[ \t]*([A-Za-z\x7F-\xFF_][0-9A-Za-z\x7F-\xFF_]*)",
56
		"\\2", "f,function,functions", NULL);
57
	addTagRegex(language, "(^|[ \t])\\$([A-Za-z\x7F-\xFF_][0-9A-Za-z\x7F-\xFF_]*)[ \t]*=",
58
		"\\2", "v,variable,variables", NULL);
59
60
	// function regex is covered by PHP regex
61
	addTagRegex (language, "(^|[ \t])([A-Za-z0-9_]+)[ \t]*[=:][ \t]*function[ \t]*\\(",
62
		"\\2", "j,jsfunction,javascript functions", NULL);
63
	addTagRegex (language, "(^|[ \t])([A-Za-z0-9_.]+)\\.([A-Za-z0-9_]+)[ \t]*=[ \t]*function[ \t]*\\(",
64
		"\\2.\\3", "j,jsfunction,javascript functions", NULL);
65
	addTagRegex (language, "(^|[ \t])([A-Za-z0-9_.]+)\\.([A-Za-z0-9_]+)[ \t]*=[ \t]*function[ \t]*\\(",
66
		"\\3", "j,jsfunction,javascript functions", NULL);
67
}
68
69
/* Create parser definition stucture */
70
extern parserDefinition* PhpParser (void)
71
{
72
	static const char *const extensions [] = { "php", "php3", "phtml", NULL };
73
	parserDefinition* def = parserNew ("PHP");
74
	def->extensions = extensions;
75
	def->initialize = installPHPRegex;
76
	def->regex      = TRUE;
77
	return def;
78
}
79
80
#if 0
81
45
static boolean isLetter(const int c)
82
static boolean isLetter(const int c)
46
{
83
{
47
	return (boolean)(isalpha(c) || (c >= 127  &&  c <= 255));
84
	return (boolean)(isalpha(c) || (c >= 127  &&  c <= 255));
Lines 65-70 Link Here
65
	while ((line = fileReadLine ()) != NULL)
102
	while ((line = fileReadLine ()) != NULL)
66
	{
103
	{
67
		const unsigned char *cp = line;
104
		const unsigned char *cp = line;
105
		const char* f;
68
106
69
		while (isspace (*cp))
107
		while (isspace (*cp))
70
			cp++;
108
			cp++;
Lines 87-103 Link Here
87
				vStringClear (name);
125
				vStringClear (name);
88
			}
126
			}
89
		}
127
		}
90
		else if (strncmp ((const char*) cp, "function", (size_t) 8) == 0  &&
128
		else if ((f = strstr ((const char*) cp, "function")) != NULL &&
91
			isspace ((int) cp [8]))
129
			(f == (const char*) cp || isspace ((int) f [-1])) &&
130
			isspace ((int) f [8]))
92
		{
131
		{
93
			cp += 8;
132
			cp = ((const unsigned char *) f) + 8;
94
133
95
			while (isspace ((int) *cp))
134
			while (isspace ((int) *cp))
96
				++cp;
135
				++cp;
97
136
98
			if (*cp == '&')  /* skip reference character */
137
			if (*cp == '&')	/* skip reference character and following whitespace */
138
			{
99
				cp++;
139
				cp++;
100
140
141
				while (isspace ((int) *cp))
142
					++cp; 
143
			}
144
101
			vStringClear (name);
145
			vStringClear (name);
102
			while (isalnum ((int) *cp)  ||  *cp == '_')
146
			while (isalnum ((int) *cp)  ||  *cp == '_')
103
			{
147
			{
Lines 168-171 Link Here
168
	return def;
212
	return def;
169
}
213
}
170
214
215
#endif
216
171
/* vi:set tabstop=4 shiftwidth=4: */
217
/* vi:set tabstop=4 shiftwidth=4: */

Return to bug 132880