Lines 38-43
Link Here
|
38 |
{ TRUE, 'v', "variable", "variables" } |
38 |
{ TRUE, 'v', "variable", "variables" } |
39 |
}; |
39 |
}; |
40 |
|
40 |
|
|
|
41 |
static const unsigned char *keywords[] = { |
42 |
"abstract", |
43 |
"public", |
44 |
"private", |
45 |
"protected", |
46 |
"static", |
47 |
"final", |
48 |
NULL |
49 |
}; |
50 |
|
41 |
/* |
51 |
/* |
42 |
* FUNCTION DEFINITIONS |
52 |
* FUNCTION DEFINITIONS |
43 |
*/ |
53 |
*/ |
Lines 57-65
Link Here
|
57 |
return (boolean)(isVarChar1 (c) || isdigit (c)); |
67 |
return (boolean)(isVarChar1 (c) || isdigit (c)); |
58 |
} |
68 |
} |
59 |
|
69 |
|
|
|
70 |
static boolean isKeyword(const unsigned char *cp) { |
71 |
int i=0; |
72 |
size_t sl; |
73 |
unsigned const char *kw; |
74 |
|
75 |
while (kw = keywords[i++]) { |
76 |
sl = strlen(kw); |
77 |
if (strncmp(cp, kw, sl)==0 && isspace(cp[sl])) { |
78 |
return sl; |
79 |
} |
80 |
} |
81 |
return 0; |
82 |
} |
83 |
|
60 |
static void findPhpTags (void) |
84 |
static void findPhpTags (void) |
61 |
{ |
85 |
{ |
62 |
vString *name = vStringNew (); |
86 |
vString *name = vStringNew (); |
|
|
87 |
int cpa; |
63 |
const unsigned char *line; |
88 |
const unsigned char *line; |
64 |
|
89 |
|
65 |
while ((line = fileReadLine ()) != NULL) |
90 |
while ((line = fileReadLine ()) != NULL) |
Lines 69-74
Link Here
|
69 |
while (isspace (*cp)) |
94 |
while (isspace (*cp)) |
70 |
cp++; |
95 |
cp++; |
71 |
|
96 |
|
|
|
97 |
while (cpa = isKeyword(cp)) { |
98 |
cp += cpa; |
99 |
while (isspace (*cp)) |
100 |
cp++; |
101 |
} |
102 |
|
103 |
|
72 |
if (*(const char*)cp == '$' && isVarChar1 (*(const char*)(cp+1))) |
104 |
if (*(const char*)cp == '$' && isVarChar1 (*(const char*)(cp+1))) |
73 |
{ |
105 |
{ |
74 |
cp += 1; |
106 |
cp += 1; |
Lines 153-158
Link Here
|
153 |
makeSimpleTag (name, PhpKinds, K_DEFINE); |
185 |
makeSimpleTag (name, PhpKinds, K_DEFINE); |
154 |
vStringClear (name); |
186 |
vStringClear (name); |
155 |
} |
187 |
} |
|
|
188 |
else if (strncmp ((const char*) cp, "const", (size_t) 5) == 0 && |
189 |
! isalnum ((int) cp [5])) |
190 |
{ |
191 |
cp += 5; |
192 |
|
193 |
while (isspace ((int) *cp)) |
194 |
++cp; |
195 |
|
196 |
vStringClear (name); |
197 |
while (isalnum ((int) *cp) || *cp == '_') |
198 |
{ |
199 |
vStringPut (name, (int) *cp); |
200 |
++cp; |
201 |
} |
202 |
vStringTerminate (name); |
203 |
makeSimpleTag (name, PhpKinds, K_DEFINE); |
204 |
vStringClear (name); |
205 |
} |
156 |
} |
206 |
} |
157 |
vStringDelete (name); |
207 |
vStringDelete (name); |
158 |
} |
208 |
} |