initial import
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / editors / PHPScanner.java
1 package net.sourceforge.phpeclipse.editors;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.eclipse.jface.text.TextAttribute;
7 import org.eclipse.jface.text.rules.IRule;
8 import org.eclipse.jface.text.rules.IToken;
9 import org.eclipse.jface.text.rules.RuleBasedScanner;
10 import org.eclipse.jface.text.rules.SingleLineRule;
11 import org.eclipse.jface.text.rules.Token;
12 import org.eclipse.jface.text.rules.WhitespaceRule;
13 import org.eclipse.jface.text.rules.WordRule;
14 import org.eclipse.swt.SWT;
15
16 public class PHPScanner extends RuleBasedScanner {
17
18         public PHPScanner(ColorManager manager) {
19                 List rules = new ArrayList();
20                 IToken procInstr =
21                         new Token(
22                                 new TextAttribute(
23                                         manager.getColor(IPHPColorConstants.PROC_INSTR)));
24
25                 ColorManager colors = new ColorManager();
26
27                 IToken php_string =
28                         new Token(
29                                 new TextAttribute(
30                                         colors.getColor(IPHPColorConstants.PHP_STRING),
31                                         null,
32                                         SWT.DEFAULT));
33                 IToken php_default =
34                         new Token(
35                                 new TextAttribute(
36                                         colors.getColor(IPHPColorConstants.PHP_DEFAULT),
37                                         null,
38                                         SWT.BOLD));
39                 IToken php_tag =
40                         new Token(
41                                 new TextAttribute(
42                                         colors.getColor(IPHPColorConstants.PHP_TAG),
43                                         null,
44                                         SWT.DEFAULT));
45                 IToken php_comment =
46                         new Token(
47                                 new TextAttribute(
48                                         colors.getColor(IPHPColorConstants.PHP_COMMENT),
49                                         null,
50                                         SWT.DEFAULT));
51                 IToken php_function =
52                         new Token(
53                                 new TextAttribute(
54                                         colors.getColor(IPHPColorConstants.PHP_FUNCTION),
55                                         null,
56                                         SWT.BOLD));
57
58                 //Add rule for processing instructions
59                 rules.add(new SingleLineRule("<?", "?>", php_tag));
60                 rules.add(new SingleLineRule("<?php", "?>", php_tag));
61                 rules.add(new SingleLineRule("<?PHP", "?>", php_tag));
62                 rules.add(new SingleLineRule("\"", "\"", php_string));
63                 rules.add(new SingleLineRule("'", "'", php_string));
64                 rules.add(new SingleLineRule("//", "//", php_comment));
65
66                 //
67                 WordRule rule = new WordRule(new WordDetector());
68                 rule.addWord("if", php_default);
69                 rule.addWord("else", php_default);
70                 rule.addWord("elseif", php_default);
71                 rule.addWord("while", php_default);
72                 rule.addWord("do", php_default);
73                 rule.addWord("for", php_default);
74                 rule.addWord("foreach", php_default);
75                 rule.addWord("break", php_default);
76                 rule.addWord("continue", php_default);
77                 rule.addWord("switch", php_default);
78                 rule.addWord("declare", php_default);
79                 rule.addWord("ticks", php_default);
80                 rule.addWord("require", php_default);
81                 rule.addWord("include", php_default);
82                 rule.addWord("true", php_default);
83                 rule.addWord("false", php_default);
84
85                 /*
86                 rule.addWord( "abs", php_function);
87                 rule.addWord( "acos", php_function);
88                 rule.addWord( "addcslashes", php_function);
89                 rule.addWord( "addslashes", php_function);
90                 rule.addWord( "apache_lookup_uri", php_function);
91                 rule.addWord( "apache_note", php_function);
92                 rule.addWord( "array", php_function);
93                 rule.addWord( "array_count_values", php_function);
94                 rule.addWord( "array_diff", php_function);
95                 rule.addWord( "array_filter", php_function);
96                 rule.addWord( "array_flip", php_function);
97                 rule.addWord( "array_intersect", php_function);
98                 rule.addWord( "array_keys", php_function);
99                 rule.addWord( "array_map", php_function);
100                 rule.addWord( "array_merge", php_function);
101                 rule.addWord( "array_merge_recursive", php_function);
102                 rule.addWord( "array_multisort", php_function);
103                 rule.addWord( "array_pad", php_function);
104                 rule.addWord( "array_pop", php_function);
105                 rule.addWord( "array_push", php_function);
106                 rule.addWord( "array_rand", php_function);
107                 rule.addWord( "array_reduce", php_function);
108                 rule.addWord( "array_reverse", php_function);
109                 rule.addWord( "array_search", php_function);
110                 rule.addWord( "array_shift", php_function);
111                 rule.addWord( "array_slice", php_function);
112                 rule.addWord( "array_splice", php_function);
113                 rule.addWord( "array_sum", php_function);
114                 rule.addWord( "array_unique", php_function);
115                 rule.addWord( "array_unshift", php_function);
116                 rule.addWord( "array_values", php_function);
117                 rule.addWord( "array_walk", php_function);
118                 rule.addWord( "arsort", php_function);
119                 rule.addWord( "ascii2ebcdic", php_function);
120                 rule.addWord( "asin", php_function);
121                 rule.addWord( "asort", php_function);
122                 rule.addWord( "assert", php_function);
123                 rule.addWord( "assert-options", php_function);
124                 rule.addWord( "atan", php_function);
125                 rule.addWord( "atan2", php_function);
126                 rule.addWord( "base64_decode", php_function);
127                 rule.addWord( "base64_encode", php_function);
128                 rule.addWord( "base_convert", php_function);
129                 rule.addWord( "basename", php_function);
130                 rule.addWord( "bin2hex", php_function);
131                 rule.addWord( "bindec", php_function);
132                 rule.addWord( "call_user_method", php_function);
133                 rule.addWord( "call_user_method_array", php_function);
134                 rule.addWord( "ceil", php_function);
135                 rule.addWord( "chdir", php_function);
136                 rule.addWord( "checkdate", php_function);
137                 rule.addWord( "checkdnsrr", php_function);
138                 rule.addWord( "chgrp", php_function);
139                 rule.addWord( "chmod", php_function);
140                 rule.addWord( "chop", php_function);
141                 rule.addWord( "chown", php_function);
142                 rule.addWord( "chr", php_function);
143                 rule.addWord( "chroot", php_function);
144                 rule.addWord( "chunk_split", php_function);
145                 rule.addWord( "class_exists", php_function);
146                 rule.addWord( "clearstatcache", php_function);
147                 rule.addWord( "closedir", php_function);
148                 rule.addWord( "closelog", php_function);
149                 rule.addWord( "compact", php_function);
150                 rule.addWord( "connection_aborted", php_function);
151                 rule.addWord( "connection_status", php_function);
152                 rule.addWord( "connection_timeout", php_function);
153                 rule.addWord( "constant", php_function);
154                 rule.addWord( "convert_cyr_string", php_function);
155                 rule.addWord( "copy", php_function);
156                 rule.addWord( "cos", php_function);
157                 rule.addWord( "count", php_function);
158                 rule.addWord( "count_chars", php_function);
159                 rule.addWord( "crc32", php_function);
160                 rule.addWord( "crypt", php_function);
161                 rule.addWord( "current", php_function);
162                 rule.addWord( "date", php_function);
163                 rule.addWord( "debugger_off", php_function);
164                 rule.addWord( "debugger_on", php_function);
165                 rule.addWord( "decbin", php_function);
166                 rule.addWord( "dechex", php_function);
167                 rule.addWord( "decoct", php_function);
168                 rule.addWord( "define", php_function);
169                 rule.addWord( "define_syslog_variables", php_function);
170                 rule.addWord( "defined", php_function);
171                 rule.addWord( "deg2rad", php_function);
172                 rule.addWord( "delete", php_function);
173                 rule.addWord( "die", php_function);
174                 rule.addWord( "dir", php_function);
175                 rule.addWord( "dirname", php_function);
176                 rule.addWord( "disk_total_space", php_function);
177                 rule.addWord( "diskfreespace", php_function);
178                 rule.addWord( "dl", php_function);
179                 rule.addWord( "doubleval", php_function);
180                 rule.addWord( "each", php_function);
181                 rule.addWord( "easter_date", php_function);
182                 rule.addWord( "easter_days", php_function);
183                 rule.addWord( "ebcdic2ascii", php_function);
184                 rule.addWord( "echo", php_function);
185                 rule.addWord( "empty", php_function);
186                 rule.addWord( "end", php_function);
187                 rule.addWord( "error_log", php_function);
188                 rule.addWord( "error_reporting", php_function);
189                 rule.addWord( "eval", php_function);
190                 rule.addWord( "exit", php_function);
191                 rule.addWord( "exp", php_function);
192                 rule.addWord( "explode", php_function);
193                 rule.addWord( "extension_loaded", php_function);
194                 rule.addWord( "extract", php_function);
195                 rule.addWord( "ezmlm_hash", php_function);
196                 rule.addWord( "fclose", php_function);
197                 rule.addWord( "feof", php_function);
198                 rule.addWord( "fflush", php_function);
199                 rule.addWord( "fgetc", php_function);
200                 rule.addWord( "fgetcsv", php_function);
201                 rule.addWord( "fgets", php_function);
202                 rule.addWord( "fgetss", php_function);
203                 rule.addWord( "file", php_function);
204                 rule.addWord( "file_exists", php_function);
205                 rule.addWord( "fileatime", php_function);
206                 rule.addWord( "filectime", php_function);
207                 rule.addWord( "filegroup", php_function);
208                 rule.addWord( "fileinode", php_function);
209                 rule.addWord( "filemtime", php_function);
210                 rule.addWord( "fileowner", php_function);
211                 rule.addWord( "fileperms", php_function);
212                 rule.addWord( "filesize", php_function);
213                 rule.addWord( "filetype", php_function);
214                 rule.addWord( "flock", php_function);
215                 rule.addWord( "floor", php_function);
216                 rule.addWord( "flush", php_function);
217                 rule.addWord( "fopen", php_function);
218                 rule.addWord( "fpassthru", php_function);
219                 rule.addWord( "fputs", php_function);
220                 rule.addWord( "fread", php_function);
221                 rule.addWord( "frenchtojd", php_function);
222                 rule.addWord( "fscanf", php_function);
223                 rule.addWord( "fseek", php_function);
224                 rule.addWord( "fsockopen", php_function);
225                 rule.addWord( "fstat", php_function);
226                 rule.addWord( "ftell", php_function);
227                 rule.addWord( "ftp_cdup", php_function);
228                 rule.addWord( "ftp_chdir", php_function);
229                 rule.addWord( "ftp_connect", php_function);
230                 rule.addWord( "ftp_delete", php_function);
231                 rule.addWord( "ftp_fget", php_function);
232                 rule.addWord( "ftp_fput", php_function);
233                 rule.addWord( "ftp_get", php_function);
234                 rule.addWord( "ftp_login", php_function);
235                 rule.addWord( "ftp_mdtm", php_function);
236                 rule.addWord( "ftp_mkdir", php_function);
237                 rule.addWord( "ftp_nlist", php_function);
238                 rule.addWord( "ftp_pasv", php_function);
239                 rule.addWord( "ftp_put", php_function);
240                 rule.addWord( "ftp_pwd", php_function);
241                 rule.addWord( "ftp_quit", php_function);
242                 rule.addWord( "ftp_rawlist", php_function);
243                 rule.addWord( "ftp_rename", php_function);
244                 rule.addWord( "ftp_rmdir", php_function);
245                 rule.addWord( "ftp_site", php_function);
246                 rule.addWord( "ftp_size", php_function);
247                 rule.addWord( "ftp_systype", php_function);
248                 rule.addWord( "ftruncate", php_function);
249                 rule.addWord( "fwrite", php_function);
250                 rule.addWord( "get_browser", php_function);
251                 rule.addWord( "get_cfg_var", php_function);
252                 rule.addWord( "get_class", php_function);
253                 rule.addWord( "get_class_methods", php_function);
254                 rule.addWord( "get_class_vars", php_function);
255                 rule.addWord( "get_current_user", php_function);
256                 rule.addWord( "get_declared_classes", php_function);
257                 rule.addWord( "get_defined_constants", php_function);
258                 rule.addWord( "get_defined_vars", php_function);
259                 rule.addWord( "get_extension_funcs", php_function);
260                 rule.addWord( "get_html_translation_table", php_function);
261                 rule.addWord( "get_included_files", php_function);
262                 rule.addWord( "get_loaded_extensions", php_function);
263                 rule.addWord( "get_magic_quotes_gpc", php_function);
264                 rule.addWord( "get_magic_quotes_runtime", php_function);
265                 rule.addWord( "get_meta_tags", php_function);
266                 rule.addWord( "get_object_vars", php_function);
267                 rule.addWord( "get_parent_class", php_function);
268                 rule.addWord( "get_required_files", php_function);
269                 rule.addWord( "get_resource_type", php_function);
270                 rule.addWord( "getallheaders", php_function);
271                 rule.addWord( "getcwd", php_function);
272                 rule.addWord( "getdate", php_function);
273                 rule.addWord( "getenv", php_function);
274                 rule.addWord( "gethostbyaddr", php_function);
275                 rule.addWord( "gethostbyname", php_function);
276                 rule.addWord( "gethostbynamel", php_function);
277                 rule.addWord( "getimagesize", php_function);
278                 rule.addWord( "getlastmod", php_function);
279                 rule.addWord( "getmxrr", php_function);
280                 rule.addWord( "getmyinode", php_function);
281                 rule.addWord( "getmypid", php_function);
282                 rule.addWord( "getmyuid", php_function);
283                 rule.addWord( "getprotobyname", php_function);
284                 rule.addWord( "getprotobynumber", php_function);
285                 rule.addWord( "getrandmax", php_function);
286                 rule.addWord( "getrusage", php_function);
287                 rule.addWord( "getservbyname", php_function);
288                 rule.addWord( "getservbyport", php_function);
289                 rule.addWord( "gettimeofday", php_function);
290                 rule.addWord( "gettype", php_function);
291                 rule.addWord( "gmdate", php_function);
292                 rule.addWord( "gmmktime", php_function);
293                 rule.addWord( "gmstrftime", php_function);
294                 rule.addWord( "gregoriantojd", php_function);
295                 rule.addWord( "header", php_function);
296                 rule.addWord( "headers_sent", php_function);
297                 rule.addWord( "hebrev", php_function);
298                 rule.addWord( "hebrevc", php_function);
299                 rule.addWord( "hexdec", php_function);
300                 rule.addWord( "highlight_file", php_function);
301                 rule.addWord( "highlight_string", php_function);
302                 rule.addWord( "htmlentities", php_function);
303                 rule.addWord( "htmlspecialchars", php_function);
304                 rule.addWord( "ignore_user_abort", php_function);
305                 rule.addWord( "imagealphablending", php_function);
306                 rule.addWord( "imagearc", php_function);
307                 rule.addWord( "imagechar", php_function);
308                 rule.addWord( "imagecharup", php_function);
309                 rule.addWord( "imagecolorallocate", php_function);
310                 rule.addWord( "imagecolorat", php_function);
311                 rule.addWord( "imagecolorclosest", php_function);
312                 rule.addWord( "imagecolorclosestalpha", php_function);
313                 rule.addWord( "imagecolordeallocate", php_function);
314                 rule.addWord( "imagecolorexact", php_function);
315                 rule.addWord( "imagecolorexactalpha", php_function);
316                 rule.addWord( "imagecolorresolve", php_function);
317                 rule.addWord( "imagecolorresolvealpha", php_function);
318                 rule.addWord( "imagecolorset", php_function);
319                 rule.addWord( "imagecolorsforindex", php_function);
320                 rule.addWord( "imagecolorstotal", php_function);
321                 rule.addWord( "imagecolortransparent", php_function);
322                 rule.addWord( "imagecopy", php_function);
323                 rule.addWord( "imagecopymerge", php_function);
324                 rule.addWord( "imagecopymergegray", php_function);
325                 rule.addWord( "imagecopyresampled", php_function);
326                 rule.addWord( "imagecopyresized", php_function);
327                 rule.addWord( "imagecreate", php_function);
328                 rule.addWord( "imagecreatefromgif", php_function);
329                 rule.addWord( "imagecreatefromjpeg", php_function);
330                 rule.addWord( "imagecreatefrompng", php_function);
331                 rule.addWord( "imagecreatefromstring", php_function);
332                 rule.addWord( "imagecreatefromwbmp", php_function);
333                 rule.addWord( "imagecreatetruecolor", php_function);
334                 rule.addWord( "imagedashedline", php_function);
335                 rule.addWord( "imagedestroy", php_function);
336                 rule.addWord( "imageellipse", php_function);
337                 rule.addWord( "imagefill", php_function);
338                 rule.addWord( "imagefilledarc", php_function);
339                 rule.addWord( "imagefilledellipse", php_function);
340                 rule.addWord( "imagefilledpolygon", php_function);
341                 rule.addWord( "imagefilledrectangle", php_function);
342                 rule.addWord( "imagefilltoborder", php_function);
343                 rule.addWord( "imagefontheight", php_function);
344                 rule.addWord( "imagefontwidth", php_function);
345                 rule.addWord( "imagegammacorrect", php_function);
346                 rule.addWord( "imagegif", php_function);
347                 rule.addWord( "imageinterlace", php_function);
348                 rule.addWord( "imagejpeg", php_function);
349                 rule.addWord( "imageline", php_function);
350                 rule.addWord( "imageloadfont", php_function);
351                 rule.addWord( "imagepng", php_function);
352                 rule.addWord( "imagepolygon", php_function);
353                 rule.addWord( "imagepsbbox", php_function);
354                 rule.addWord( "imagepsencodefont", php_function);
355                 rule.addWord( "imagepsextendfont", php_function);
356                 rule.addWord( "imagepsfreefont", php_function);
357                 rule.addWord( "imagepsloadfont", php_function);
358                 rule.addWord( "imagepsslantfont", php_function);
359                 rule.addWord( "imagepstext", php_function);
360                 rule.addWord( "imagerectangle", php_function);
361                 rule.addWord( "imagesetbrush", php_function);
362                 rule.addWord( "imagesetpixel", php_function);
363                 rule.addWord( "imagesetthickness", php_function);
364                 rule.addWord( "imagesettile", php_function);
365                 rule.addWord( "imagestring", php_function);
366                 rule.addWord( "imagestringup", php_function);
367                 rule.addWord( "imagesx", php_function);
368                 rule.addWord( "imagesy", php_function);
369                 rule.addWord( "imagetruecolortopalette", php_function);
370                 rule.addWord( "imagettfbbox", php_function);
371                 rule.addWord( "imagettftext", php_function);
372                 rule.addWord( "imagetypes", php_function);
373                 rule.addWord( "imagewbmp", php_function);
374                 rule.addWord( "implode", php_function);
375                 rule.addWord( "in_array", php_function);
376                 rule.addWord( "Include()", php_function);
377                 rule.addWord( "Include_once()", php_function);
378                 rule.addWord( "ini_alter", php_function);
379                 rule.addWord( "ini_get", php_function);
380                 rule.addWord( "ini_restore", php_function);
381                 rule.addWord( "ini_set", php_function);
382                 rule.addWord( "intval", php_function);
383                 rule.addWord( "ip2long", php_function);
384                 rule.addWord( "iptcparse", php_function);
385                 rule.addWord( "is_array", php_function);
386                 rule.addWord( "is_bool", php_function);
387                 rule.addWord( "is_dir", php_function);
388                 rule.addWord( "is_double", php_function);
389                 rule.addWord( "is_executable", php_function);
390                 rule.addWord( "is_file", php_function);
391                 rule.addWord( "is_float", php_function);
392                 rule.addWord( "is_int", php_function);
393                 rule.addWord( "is_integer", php_function);
394                 rule.addWord( "is_link", php_function);
395                 rule.addWord( "is_long", php_function);
396                 rule.addWord( "is_null", php_function);
397                 rule.addWord( "is_numeric", php_function);
398                 rule.addWord( "is_object", php_function);
399                 rule.addWord( "is_readable", php_function);
400                 rule.addWord( "is_real", php_function);
401                 rule.addWord( "is_resource", php_function);
402                 rule.addWord( "is_scalar", php_function);
403                 rule.addWord( "is_string", php_function);
404                 rule.addWord( "is_subclass_of", php_function);
405                 rule.addWord( "is_uploaded_file", php_function);
406                 rule.addWord( "is_writable", php_function);
407                 rule.addWord( "is_writeable", php_function);
408                 rule.addWord( "isset", php_function);
409                 rule.addWord( "jddayofweek", php_function);
410                 rule.addWord( "jdmonthname", php_function);
411                 rule.addWord( "jdtofrench", php_function);
412                 rule.addWord( "jdtogregorian", php_function);
413                 rule.addWord( "jdtojewish", php_function);
414                 rule.addWord( "jdtojulian", php_function);
415                 rule.addWord( "jdtounix", php_function);
416                 rule.addWord( "jewishtojd", php_function);
417                 rule.addWord( "join", php_function);
418                 rule.addWord( "juliantojd", php_function);
419                 rule.addWord( "key", php_function);
420                 rule.addWord( "krsort", php_function);
421                 rule.addWord( "ksort", php_function);
422                 rule.addWord( "lcg_value", php_function);
423                 rule.addWord( "leak", php_function);
424                 rule.addWord( "levenshtein", php_function);
425                 rule.addWord( "link", php_function);
426                 rule.addWord( "linkinfo", php_function);
427                 rule.addWord( "list", php_function);
428                 rule.addWord( "localeconv", php_function);
429                 rule.addWord( "localtime", php_function);
430                 rule.addWord( "log", php_function);
431                 rule.addWord( "log10", php_function);
432                 rule.addWord( "long2ip", php_function);
433                 rule.addWord( "lstat", php_function);
434                 rule.addWord( "ltrim", php_function);
435                 rule.addWord( "mail", php_function);
436                 rule.addWord( "max", php_function);
437                 rule.addWord( "mcrypt_cbc", php_function);
438                 rule.addWord( "mcrypt_cfb", php_function);
439                 rule.addWord( "mcrypt_create_iv", php_function);
440                 rule.addWord( "mcrypt_decrypt", php_function);
441                 rule.addWord( "mcrypt_ecb", php_function);
442                 rule.addWord( "mcrypt_enc_get_algorithms_name", php_function);
443                 rule.addWord( "mcrypt_enc_get_block_size", php_function);
444                 rule.addWord( "mcrypt_enc_get_iv_size", php_function);
445                 rule.addWord( "mcrypt_enc_get_key_size", php_function);
446                 rule.addWord( "mcrypt_enc_get_modes_name", php_function);
447                 rule.addWord( "mcrypt_enc_get_supported_key_sizes", php_function);
448                 rule.addWord( "mcrypt_enc_is_block_algorithm", php_function);
449                 rule.addWord( "mcrypt_enc_is_block_algorithm_mode", php_function);
450                 rule.addWord( "mcrypt_enc_is_block_mode", php_function);
451                 rule.addWord( "mcrypt_enc_self_test", php_function);
452                 rule.addWord( "mcrypt_encrypt", php_function);
453                 rule.addWord( "mcrypt_generic", php_function);
454                 rule.addWord( "mcrypt_generic_end", php_function);
455                 rule.addWord( "mcrypt_generic_init", php_function);
456                 rule.addWord( "mcrypt_get_block_size", php_function);
457                 rule.addWord( "mcrypt_get_cipher_name", php_function);
458                 rule.addWord( "mcrypt_get_iv_size", php_function);
459                 rule.addWord( "mcrypt_get_key_size", php_function);
460                 rule.addWord( "mcrypt_list_algorithms", php_function);
461                 rule.addWord( "mcrypt_list_modes", php_function);
462                 rule.addWord( "mcrypt_module_get_algo_block_size", php_function);
463                 rule.addWord( "mcrypt_module_get_algo_key_size", php_function);
464                 rule.addWord( "mcrypt_module_get_algo_supported_key_sizes", php_function);
465                 rule.addWord( "mcrypt_module_is_block_algorithm", php_function);
466                 rule.addWord( "mcrypt_module_is_block_algorithm_mode", php_function);
467                 rule.addWord( "mcrypt_module_is_block_mode", php_function);
468                 rule.addWord( "mcrypt_module_open", php_function);
469                 rule.addWord( "mcrypt_module_self_test", php_function);
470                 rule.addWord( "mcrypt_ofb", php_function);
471                 rule.addWord( "md5", php_function);
472                 rule.addWord( "mdecrypt_generic", php_function);
473                 rule.addWord( "metaphone", php_function);
474                 rule.addWord( "method_exists", php_function);
475                 rule.addWord( "microtime", php_function);
476                 rule.addWord( "min", php_function);
477                 rule.addWord( "mkdir", php_function);
478                 rule.addWord( "mktime", php_function);
479                 rule.addWord( "move_uploaded_file", php_function);
480                 rule.addWord( "mt_getrandmax", php_function);
481                 rule.addWord( "mt_rand", php_function);
482                 rule.addWord( "mt_srand", php_function);
483                 rule.addWord( "mysql_affected_rows", php_function);
484                 rule.addWord( "mysql_change_user", php_function);
485                 rule.addWord( "mysql_close", php_function);
486                 rule.addWord( "mysql_connect", php_function);
487                 rule.addWord( "mysql_create_db", php_function);
488                 rule.addWord( "mysql_data_seek", php_function);
489                 rule.addWord( "mysql_db_name", php_function);
490                 rule.addWord( "mysql_db_query", php_function);
491                 rule.addWord( "mysql_drop_db", php_function);
492                 rule.addWord( "mysql_errno", php_function);
493                 rule.addWord( "mysql_error", php_function);
494                 rule.addWord( "mysql_escape_string", php_function);
495                 rule.addWord( "mysql_fetch_array", php_function);
496                 rule.addWord( "mysql_fetch_assoc", php_function);
497                 rule.addWord( "mysql_fetch_field", php_function);
498                 rule.addWord( "mysql_fetch_lengths", php_function);
499                 rule.addWord( "mysql_fetch_object", php_function);
500                 rule.addWord( "mysql_fetch_row", php_function);
501                 rule.addWord( "mysql_field_flags", php_function);
502                 rule.addWord( "mysql_field_len", php_function);
503                 rule.addWord( "mysql_field_name", php_function);
504                 rule.addWord( "mysql_field_seek", php_function);
505                 rule.addWord( "mysql_field_table", php_function);
506                 rule.addWord( "mysql_field_type", php_function);
507                 rule.addWord( "mysql_free_result", php_function);
508                 rule.addWord( "mysql_get_client_info", php_function);
509                 rule.addWord( "mysql_get_host_info", php_function);
510                 rule.addWord( "mysql_get_proto_info", php_function);
511                 rule.addWord( "mysql_get_server_info", php_function);
512                 rule.addWord( "mysql_insert_id", php_function);
513                 rule.addWord( "mysql_list_dbs", php_function);
514                 rule.addWord( "mysql_list_fields", php_function);
515                 rule.addWord( "mysql_list_tables", php_function);
516                 rule.addWord( "mysql_num_fields", php_function);
517                 rule.addWord( "mysql_num_rows", php_function);
518                 rule.addWord( "mysql_pconnect", php_function);
519                 rule.addWord( "mysql_query", php_function);
520                 rule.addWord( "mysql_result", php_function);
521                 rule.addWord( "mysql_select_db", php_function);
522                 rule.addWord( "mysql_tablename", php_function);
523                 rule.addWord( "mysql_unbuffered_query", php_function);
524                 rule.addWord( "natcasesort", php_function);
525                 rule.addWord( "natsort", php_function);
526                 rule.addWord( "next", php_function);
527                 rule.addWord( "nl2br", php_function);
528                 rule.addWord( "number_format", php_function);
529                 rule.addWord( "ob_end_clean", php_function);
530                 rule.addWord( "ob_end_flush", php_function);
531                 rule.addWord( "ob_get_contents", php_function);
532                 rule.addWord( "ob_get_length", php_function);
533                 rule.addWord( "ob_gzhandler", php_function);
534                 rule.addWord( "ob_implicit_flush", php_function);
535                 rule.addWord( "ob_start", php_function);
536                 rule.addWord( "octdec", php_function);
537                 rule.addWord( "opendir", php_function);
538                 rule.addWord( "openlog", php_function);
539                 rule.addWord( "ord", php_function);
540                 rule.addWord( "pack", php_function);
541                 rule.addWord( "parse_str", php_function);
542                 rule.addWord( "parse_url", php_function);
543                 rule.addWord( "pathinfo", php_function);
544                 rule.addWord( "pclose", php_function);
545                 rule.addWord( "pfsockopen", php_function);
546                 rule.addWord( "php_logo_guid", php_function);
547                 rule.addWord( "php_sapi_name", php_function);
548                 rule.addWord( "php_uname", php_function);
549                 rule.addWord( "phpcredits", php_function);
550                 rule.addWord( "phpinfo", php_function);
551                 rule.addWord( "phpversion", php_function);
552                 rule.addWord( "pi", php_function);
553                 rule.addWord( "popen", php_function);
554                 rule.addWord( "pos", php_function);
555                 rule.addWord( "pow", php_function);
556                 rule.addWord( "prev", php_function);
557                 rule.addWord( "print", php_function);
558                 rule.addWord( "print_r", php_function);
559                 rule.addWord( "printf", php_function);
560                 rule.addWord( "putenv", php_function);
561                 rule.addWord( "quoted_printable_decode", php_function);
562                 rule.addWord( "quotemeta", php_function);
563                 rule.addWord( "rad2deg", php_function);
564                 rule.addWord( "rand", php_function);
565                 rule.addWord( "range", php_function);
566                 rule.addWord( "rawurldecode", php_function);
567                 rule.addWord( "rawurlencode", php_function);
568                 rule.addWord( "read_exif_data", php_function);
569                 rule.addWord( "readdir", php_function);
570                 rule.addWord( "readfile", php_function);
571                 rule.addWord( "readlink", php_function);
572                 rule.addWord( "realpath", php_function);
573                 rule.addWord( "rename", php_function);
574                 rule.addWord( "Require()", php_function);
575                 rule.addWord( "Require_once()", php_function);
576                 rule.addWord( "reset", php_function);
577                 rule.addWord( "restore_error_handler", php_function);
578                 rule.addWord( "rewind", php_function);
579                 rule.addWord( "rewinddir", php_function);
580                 rule.addWord( "rmdir", php_function);
581                 rule.addWord( "round", php_function);
582                 rule.addWord( "rsort", php_function);
583                 rule.addWord( "rtrim", php_function);
584                 rule.addWord( "serialize", php_function);
585                 rule.addWord( "session_cache_limiter", php_function);
586                 rule.addWord( "session_decode", php_function);
587                 rule.addWord( "session_destroy", php_function);
588                 rule.addWord( "session_encode", php_function);
589                 rule.addWord( "session_get_cookie_params", php_function);
590                 rule.addWord( "session_id", php_function);
591                 rule.addWord( "session_is_registered", php_function);
592                 rule.addWord( "session_module_name", php_function);
593                 rule.addWord( "session_name", php_function);
594                 rule.addWord( "session_register", php_function);
595                 rule.addWord( "session_save_path", php_function);
596                 rule.addWord( "session_set_cookie_params", php_function);
597                 rule.addWord( "session_set_save_handler", php_function);
598                 rule.addWord( "session_start", php_function);
599                 rule.addWord( "session_unregister", php_function);
600                 rule.addWord( "session_unset", php_function);
601                 rule.addWord( "session_write_close", php_function);
602                 rule.addWord( "set_error_handler", php_function);
603                 rule.addWord( "set_file_buffer", php_function);
604                 rule.addWord( "set_magic_quotes_runtime", php_function);
605                 rule.addWord( "set_time_limit", php_function);
606                 rule.addWord( "setcookie", php_function);
607                 rule.addWord( "setlocale", php_function);
608                 rule.addWord( "settype", php_function);
609                 rule.addWord( "show_source", php_function);
610                 rule.addWord( "shuffle", php_function);
611                 rule.addWord( "similar_text", php_function);
612                 rule.addWord( "sin", php_function);
613                 rule.addWord( "sizeof", php_function);
614                 rule.addWord( "sleep", php_function);
615                 rule.addWord( "socket_get_status", php_function);
616                 rule.addWord( "socket_set_blocking", php_function);
617                 rule.addWord( "socket_set_timeout", php_function);
618                 rule.addWord( "sort", php_function);
619                 rule.addWord( "soundex", php_function);
620                 rule.addWord( "sprintf", php_function);
621                 rule.addWord( "sqrt", php_function);
622                 rule.addWord( "srand", php_function);
623                 rule.addWord( "sscanf", php_function);
624                 rule.addWord( "stat", php_function);
625                 rule.addWord( "str_pad", php_function);
626                 rule.addWord( "str_repeat", php_function);
627                 rule.addWord( "str_replace", php_function);
628                 rule.addWord( "strcasecmp", php_function);
629                 rule.addWord( "strchr", php_function);
630                 rule.addWord( "strcmp", php_function);
631                 rule.addWord( "strcoll", php_function);
632                 rule.addWord( "strcspn", php_function);
633                 rule.addWord( "strftime", php_function);
634                 rule.addWord( "strip_tags", php_function);
635                 rule.addWord( "stripcslashes", php_function);
636                 rule.addWord( "stripslashes", php_function);
637                 rule.addWord( "stristr", php_function);
638                 rule.addWord( "strlen", php_function);
639                 rule.addWord( "strnatcasecmp", php_function);
640                 rule.addWord( "strnatcmp", php_function);
641                 rule.addWord( "strncasecmp", php_function);
642                 rule.addWord( "strncmp", php_function);
643                 rule.addWord( "strpos", php_function);
644                 rule.addWord( "strrchr", php_function);
645                 rule.addWord( "strrev", php_function);
646                 rule.addWord( "strrpos", php_function);
647                 rule.addWord( "strspn", php_function);
648                 rule.addWord( "strstr", php_function);
649                 rule.addWord( "strtok", php_function);
650                 rule.addWord( "strtolower", php_function);
651                 rule.addWord( "strtotime", php_function);
652                 rule.addWord( "strtoupper", php_function);
653                 rule.addWord( "strtr", php_function);
654                 rule.addWord( "strval", php_function);
655                 rule.addWord( "substr", php_function);
656                 rule.addWord( "substr_count", php_function);
657                 rule.addWord( "substr_replace", php_function);
658                 rule.addWord( "symlink", php_function);
659                 rule.addWord( "syslog", php_function);
660                 rule.addWord( "tan", php_function);
661                 rule.addWord( "tempnam", php_function);
662                 rule.addWord( "time", php_function);
663                 rule.addWord( "tmpfile", php_function);
664                 rule.addWord( "touch", php_function);
665                 rule.addWord( "trigger_error", php_function);
666                 rule.addWord( "trim", php_function);
667                 rule.addWord( "uasort", php_function);
668                 rule.addWord( "ucfirst", php_function);
669                 rule.addWord( "ucwords", php_function);
670                 rule.addWord( "uksort", php_function);
671                 rule.addWord( "umask", php_function);
672                 rule.addWord( "uniqid", php_function);
673                 rule.addWord( "unixtojd", php_function);
674                 rule.addWord( "unlink", php_function);
675                 rule.addWord( "unpack", php_function);
676                 rule.addWord( "unserialize", php_function);
677                 rule.addWord( "unset", php_function);
678                 rule.addWord( "urldecode", php_function);
679                 rule.addWord( "urlencode", php_function);
680                 rule.addWord( "user_error", php_function);
681                 rule.addWord( "usleep", php_function);
682                 rule.addWord( "usort", php_function);
683                 rule.addWord( "var_dump", php_function);
684                 rule.addWord( "virtual", php_function);
685                 rule.addWord( "wordwrap", php_function);
686                 rule.addWord( "zend_logo_guid", php_function);
687                 rule.addWord( "zend_version ", php_function);
688                 */
689                 rules.add(rule);
690
691                 // Add generic whitespace rule.
692                 rules.add(new WhitespaceRule(new WhitespaceDetector()));
693
694                 IRule[] result = new IRule[rules.size()];
695                 rules.toArray(result);
696
697                 setRules(result);
698         }
699 }