1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
10 Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.phpeditor.php;
14 import java.util.ArrayList;
15 import java.util.List;
17 import net.sourceforge.phpeclipse.phpeditor.util.PHPColorProvider;
18 import net.sourceforge.phpeclipse.phpeditor.util.PHPWhitespaceDetector;
19 import net.sourceforge.phpeclipse.phpeditor.util.PHPWordDetector;
20 import org.eclipse.jface.text.TextAttribute;
21 import org.eclipse.jface.text.rules.EndOfLineRule;
22 import org.eclipse.jface.text.rules.ICharacterScanner;
23 import org.eclipse.jface.text.rules.IRule;
24 import org.eclipse.jface.text.rules.IToken;
25 import org.eclipse.jface.text.rules.IWordDetector;
26 import org.eclipse.jface.text.rules.MultiLineRule;
27 import org.eclipse.jface.text.rules.RuleBasedScanner;
28 import org.eclipse.jface.text.rules.SingleLineRule;
29 import org.eclipse.jface.text.rules.Token;
30 import org.eclipse.jface.text.rules.WhitespaceRule;
31 import org.eclipse.jface.text.rules.WordRule;
34 * A Java code scanner.
36 public class PHPCodeScanner extends RuleBasedScanner {
38 private static String[] fgKeywords =
76 public static String[] fgFunctionNames =
96 "apache_child_terminate",
101 "array_count_values",
109 "array_merge_recursive",
166 "call_user_func_array",
168 "call_user_method_array",
209 "confirm_cybermut_compiled",
210 "confirm_extname_compiled",
212 "connection_aborted",
215 "convert_cyr_string",
220 "cpdf_add_annotation",
228 "cpdf_closepath_fill_stroke",
229 "cpdf_closepath_stroke",
230 "cpdf_continue_text",
236 "cpdf_finalize_page",
237 "cpdf_global_set_document_limits",
243 "cpdf_output_buffer",
245 "cpdf_place_inline_image",
255 "cpdf_set_action_url",
256 "cpdf_set_char_spacing",
258 "cpdf_set_current_page",
260 "cpdf_set_font_directories",
261 "cpdf_set_font_map_file",
262 "cpdf_set_horiz_scaling",
265 "cpdf_set_page_animation",
267 "cpdf_set_text_matrix",
269 "cpdf_set_text_rendering",
270 "cpdf_set_text_rise",
272 "cpdf_set_viewer_preferences",
273 "cpdf_set_word_spacing",
278 "cpdf_setgray_stroke",
282 "cpdf_setmiterlimit",
284 "cpdf_setrgbcolor_fill",
285 "cpdf_setrgbcolor_stroke",
294 "crack_getlastmessage",
338 "cybercash_base64_decode",
339 "cybercash_base64_encode",
342 "cybermut_creerformulairecm",
343 "cybermut_creerreponsecm",
361 "dbase_delete_record",
363 "dbase_get_record_with_names",
368 "dbase_replace_record",
391 "define_syslog_variables",
399 "display_disabled_function",
405 "domxml_elem_get_attribute",
406 "domxml_elem_set_attribute",
407 "domxml_get_attribute",
412 "domxml_node_attributes",
413 "domxml_node_children",
414 "domxml_node_new_child",
415 "domxml_node_set_content",
416 "domxml_node_unlink_node",
418 "domxml_set_attribute",
420 "domxml_unlink_node",
453 "fbsql_affected_rows",
461 "fbsql_database_password",
469 "fbsql_fetch_lengths",
470 "fbsql_fetch_object",
510 "fdf_next_field_name",
516 "fdf_set_javascript_action",
519 "fdf_set_submit_form_action",
538 "filepro_fieldcount",
541 "filepro_fieldwidth",
598 "get_declared_classes",
599 "get_defined_functions",
601 "get_extension_funcs",
602 "get_html_translation_table",
603 "get_included_files",
604 "get_loaded_extensions",
605 "get_magic_quotes_gpc",
606 "get_magic_quotes_runtime",
610 "get_required_files",
680 "gmp_perfect_square",
732 "hw_connection_info",
737 "hw_document_attributes",
738 "hw_document_bodytag",
739 "hw_document_content",
740 "hw_document_setcontent",
752 "hw_getchildcollobj",
753 "hw_getchilddoccoll",
754 "hw_getchilddoccollobj",
756 "hw_getobjectbyftquery",
757 "hw_getobjectbyftquerycoll",
758 "hw_getobjectbyftquerycollobj",
759 "hw_getobjectbyftqueryobj",
760 "hw_getobjectbyquery",
761 "hw_getobjectbyquerycoll",
762 "hw_getobjectbyquerycollobj",
763 "hw_getobjectbyqueryobj",
768 "hw_getremotechildren",
769 "hw_getsrcbydestobj",
784 "hw_new_document_from_file",
786 "hw_output_document",
809 "ibase_fetch_object",
821 "icap_create_calendar",
822 "icap_delete_calendar",
829 "icap_rename_calendar",
834 "iconv_get_encoding",
835 "iconv_set_encoding",
837 "ifx_blobinfile_mode",
848 "ifx_fieldproperties",
856 "ifx_htmltbl_result",
876 "iis_getdirsecurity",
878 "iis_getserverbycomment",
879 "iis_getserverbypath",
880 "iis_getserverright",
881 "iis_getservicestate",
883 "iis_setappsettings",
884 "iis_setdirsecurity",
886 "iis_setserverright",
892 "imagealphablending",
896 "imagecolorallocate",
899 "imagecolorclosestalpha",
900 "imagecolorclosesthwb",
901 "imagecolordeallocate",
903 "imagecolorexactalpha",
905 "imagecolorresolvealpha",
907 "imagecolorsforindex",
909 "imagecolortransparent",
912 "imagecopymergegray",
913 "imagecopyresampled",
916 "imagecreatefromgif",
917 "imagecreatefromjpeg",
918 "imagecreatefrompng",
919 "imagecreatefromstring",
920 "imagecreatefromwbmp",
921 "imagecreatefromxbm",
922 "imagecreatefromxpm",
923 "imagecreatetruecolor",
929 "imagefilledellipse",
930 "imagefilledpolygon",
931 "imagefilledrectangle",
962 "imagetruecolortopalette",
975 "imap_clearflag_full",
978 "imap_createmailbox",
980 "imap_deletemailbox",
983 "imap_fetch_overview",
986 "imap_fetchstructure",
990 "imap_getsubscribed",
997 "imap_listsubscribed",
1001 "imap_mail_compose",
1004 "imap_mailboxmsginfo",
1005 "imap_mime_header_decode",
1014 "imap_renamemailbox",
1016 "imap_rfc822_parse_adrlist",
1017 "imap_rfc822_parse_headers",
1018 "imap_rfc822_write_address",
1023 "imap_setflag_full",
1035 "ingres_autocommit",
1039 "ingres_fetch_array",
1040 "ingres_fetch_object",
1042 "ingres_field_length",
1043 "ingres_field_name",
1044 "ingres_field_nullable",
1045 "ingres_field_precision",
1046 "ingres_field_scale",
1047 "ingres_field_type",
1048 "ingres_num_fields",
1061 "ircg_channel_mode",
1066 "ircg_is_conn_alive",
1069 "ircg_lookup_format_messages",
1072 "ircg_nickname_escape",
1073 "ircg_nickname_unescape",
1077 "ircg_register_format_messages",
1104 "java_last_exception_clear",
1105 "java_last_exception_get",
1129 "ldap_count_entries",
1136 "ldap_first_attribute",
1138 "ldap_first_reference",
1140 "ldap_get_attributes",
1145 "ldap_get_values_len",
1151 "ldap_next_attribute",
1153 "ldap_next_reference",
1154 "ldap_parse_reference",
1155 "ldap_parse_result",
1176 "magic_quotes_runtime",
1180 "mcal_append_event",
1182 "mcal_create_calendar",
1183 "mcal_date_compare",
1187 "mcal_days_in_month",
1188 "mcal_delete_calendar",
1189 "mcal_delete_event",
1190 "mcal_event_add_attribute",
1192 "mcal_event_set_alarm",
1193 "mcal_event_set_category",
1194 "mcal_event_set_class",
1195 "mcal_event_set_description",
1196 "mcal_event_set_end",
1197 "mcal_event_set_recur_daily",
1198 "mcal_event_set_recur_monthly_mday",
1199 "mcal_event_set_recur_monthly_wday",
1200 "mcal_event_set_recur_none",
1201 "mcal_event_set_recur_weekly",
1202 "mcal_event_set_recur_yearly",
1203 "mcal_event_set_start",
1204 "mcal_event_set_title",
1205 "mcal_fetch_current_stream_event",
1207 "mcal_is_leap_year",
1210 "mcal_next_recurrence",
1213 "mcal_rename_calendar",
1218 "mcal_week_of_year",
1224 "mcrypt_enc_get_algorithms_name",
1225 "mcrypt_enc_get_block_size",
1226 "mcrypt_enc_get_iv_size",
1227 "mcrypt_enc_get_key_size",
1228 "mcrypt_enc_get_modes_name",
1229 "mcrypt_enc_get_supported_key_sizes",
1230 "mcrypt_enc_is_block_algorithm",
1231 "mcrypt_enc_is_block_algorithm_mode",
1232 "mcrypt_enc_is_block_mode",
1233 "mcrypt_enc_self_test",
1236 "mcrypt_generic_end",
1237 "mcrypt_generic_init",
1238 "mcrypt_get_block_size",
1239 "mcrypt_get_cipher_name",
1240 "mcrypt_get_iv_size",
1241 "mcrypt_get_key_size",
1242 "mcrypt_list_algorithms",
1243 "mcrypt_list_modes",
1244 "mcrypt_module_close",
1245 "mcrypt_module_get_algo_block_size",
1246 "mcrypt_module_get_algo_key_size",
1247 "mcrypt_module_get_supported_key_sizes",
1248 "mcrypt_module_is_block_algorithm",
1249 "mcrypt_module_is_block_algorithm_mode",
1250 "mcrypt_module_is_block_mode",
1251 "mcrypt_module_open",
1252 "mcrypt_module_self_test",
1260 "mhash_get_block_size",
1261 "mhash_get_hash_name",
1265 "ming_setcubicthreshold",
1270 "move_uploaded_file",
1277 "msql_affected_rows",
1290 "msql_fetch_object",
1322 "mssql_affected_rows",
1323 "mssql_affected_rows",
1333 "mssql_fetch_array",
1334 "mssql_fetch_array",
1335 "mssql_fetch_array",
1336 "mssql_fetch_batch",
1337 "mssql_fetch_field",
1338 "mssql_fetch_field",
1339 "mssql_fetch_field",
1340 "mssql_fetch_object",
1341 "mssql_fetch_object",
1342 "mssql_fetch_object",
1346 "mssql_field_length",
1352 "mssql_free_result",
1353 "mssql_free_result",
1354 "mssql_free_result",
1355 "mssql_get_last_message",
1356 "mssql_get_last_message",
1357 "mssql_get_last_message",
1358 "mssql_min_client_severity",
1359 "mssql_min_error_severity",
1360 "mssql_min_error_severity",
1361 "mssql_min_message_severity",
1362 "mssql_min_message_severity",
1363 "mssql_min_server_severity",
1364 "mssql_next_result",
1380 "mssql_rows_affected",
1394 "mysql_affected_rows",
1407 "mysql_escape_string",
1408 "mysql_fetch_array",
1409 "mysql_fetch_assoc",
1410 "mysql_fetch_field",
1411 "mysql_fetch_lengths",
1412 "mysql_fetch_object",
1414 "mysql_field_flags",
1418 "mysql_field_table",
1425 "mysql_free_result",
1427 "mysql_get_client_info",
1428 "mysql_get_host_info",
1429 "mysql_get_proto_info",
1430 "mysql_get_server_info",
1433 "mysql_list_fields",
1434 "mysql_list_tables",
1448 "mysql_unbuffered_query",
1459 "notes_create_note",
1462 "notes_header_info",
1465 "notes_mark_unread",
1477 "ob_implicit_flush",
1483 "ocicollassignelem",
1484 "ocicolldateappendelem",
1485 "ocicolldateassignelem",
1486 "ocicolldategetelem",
1493 "ocicolumnprecision",
1504 "ocifetchstatement",
1528 "ociwritelobtofile",
1534 "odbc_columnprivileges",
1546 "odbc_fetch_object",
1551 "odbc_field_precision",
1564 "odbc_procedurecolumns",
1570 "odbc_specialcolumns",
1572 "odbc_tableprivileges",
1577 "openssl_error_string",
1579 "openssl_get_privatekey",
1580 "openssl_get_publickey",
1582 "openssl_pkcs7_decrypt",
1583 "openssl_pkcs7_encrypt",
1584 "openssl_pkcs7_sign",
1585 "openssl_pkcs7_verify",
1589 "openssl_x509_checkpurpose",
1590 "openssl_x509_free",
1591 "openssl_x509_parse",
1592 "openssl_x509_read",
1616 "orbit_caught_exception",
1617 "orbit_exception_id",
1618 "orbit_exception_value",
1619 "orbit_get_repository_id",
1624 "ovrimos_close_all",
1630 "ovrimos_fetch_into",
1631 "ovrimos_fetch_row",
1632 "ovrimos_field_len",
1633 "ovrimos_field_name",
1634 "ovrimos_field_num",
1635 "ovrimos_field_type",
1636 "ovrimos_free_result",
1637 "ovrimos_longreadlen",
1638 "ovrimos_num_fields",
1642 "ovrimos_result_all",
1651 "pdf_add_annotation",
1653 "pdf_add_launchlink",
1654 "pdf_add_locallink",
1658 "pdf_add_thumbnail",
1664 "pdf_begin_pattern",
1665 "pdf_begin_template",
1671 "pdf_close_pdi_page",
1673 "pdf_closepath_fill_stroke",
1674 "pdf_closepath_stroke",
1676 "pdf_continue_text",
1690 "pdf_get_image_height",
1691 "pdf_get_image_width",
1692 "pdf_get_parameter",
1693 "pdf_get_pdi_parameter",
1694 "pdf_get_pdi_value",
1698 "pdf_makespotcolor",
1706 "pdf_open_image_file",
1708 "pdf_open_memory_image",
1710 "pdf_open_pdi_page",
1714 "pdf_place_pdi_page",
1720 "pdf_set_border_color",
1721 "pdf_set_border_dash",
1722 "pdf_set_border_style",
1723 "pdf_set_char_spacing",
1726 "pdf_set_horiz_scaling",
1728 "pdf_set_info_author",
1729 "pdf_set_info_creator",
1730 "pdf_set_info_keywords",
1731 "pdf_set_info_subject",
1732 "pdf_set_info_title",
1734 "pdf_set_parameter",
1736 "pdf_set_text_rendering",
1737 "pdf_set_text_rise",
1738 "pdf_set_transition",
1740 "pdf_set_word_spacing",
1747 "pdf_setgray_stroke",
1752 "pdf_setmiterlimit",
1755 "pdf_setrgbcolor_fill",
1756 "pdf_setrgbcolor_stroke",
1767 "pfpro_process_raw",
1770 "pg_client_encoding",
1771 "pg_clientencoding",
1807 "pg_set_client_encoding",
1808 "pg_setclientencoding",
1858 "preg_replace_callback",
1864 "printer_create_brush",
1865 "printer_create_dc",
1866 "printer_create_font",
1867 "printer_create_pen",
1868 "printer_delete_brush",
1869 "printer_delete_dc",
1870 "printer_delete_font",
1871 "printer_delete_pen",
1873 "printer_draw_chord",
1874 "printer_draw_elipse",
1875 "printer_draw_line",
1877 "printer_draw_rectangle",
1878 "printer_draw_roundrect",
1879 "printer_draw_text",
1882 "printer_get_option",
1884 "printer_logical_fontheight",
1886 "printer_select_brush",
1887 "printer_select_font",
1888 "printer_select_pen",
1889 "printer_set_option",
1890 "printer_start_doc",
1891 "printer_start_page",
1894 "pspell_add_to_personal",
1895 "pspell_add_to_session",
1897 "pspell_clear_session",
1898 "pspell_config_create",
1899 "pspell_config_ignore",
1900 "pspell_config_mode",
1901 "pspell_config_personal",
1902 "pspell_config_repl",
1903 "pspell_config_runtogether",
1904 "pspell_config_save_repl",
1906 "pspell_new_config",
1907 "pspell_new_personal",
1908 "pspell_save_wordlist",
1909 "pspell_store_replacement",
1915 "quoted_printable_decode",
1928 "readline_add_history",
1929 "readline_clear_history",
1930 "readline_completion_function",
1932 "readline_list_history",
1933 "readline_list_history",
1934 "readline_read_history",
1935 "readline_write_history",
1947 "register_shutdown_function",
1948 "register_tick_function",
1953 "restore_error_handler",
1963 "satellite_caught_exception",
1964 "satellite_exception_id",
1965 "satellite_exception_value",
1966 "satellite_get_repository_id",
1967 "satellite_load_idl",
1981 "session_cache_limiter",
1985 "session_get_cookie_params",
1987 "session_is_registered",
1988 "session_module_name",
1991 "session_save_path",
1992 "session_set_cookie_params",
1993 "session_set_save_handler",
1995 "session_unregister",
1997 "session_write_close",
1999 "set_error_handler",
2002 "set_magic_quotes_runtime",
2004 "set_socket_blocking",
2068 "snmp_get_quick_print",
2069 "snmp_set_quick_print",
2078 "socket_get_status",
2079 "socket_set_blocking",
2080 "socket_set_timeout",
2081 "socket_set_timeout",
2131 "swf_actiongotoframe",
2132 "swf_actiongotolabel",
2133 "swf_actionnextframe",
2135 "swf_actionprevframe",
2136 "swf_actionsettarget",
2138 "swf_actiontogglequality",
2139 "swf_actionwaitforframe",
2140 "swf_addbuttonrecord",
2156 "swf_getbitmapinfo",
2181 "swf_shapecurveto3",
2182 "swf_shapefillbitmapclip",
2183 "swf_shapefillbitmaptile",
2185 "swf_shapefillsolid",
2186 "swf_shapelinesolid",
2191 "swf_startdoaction",
2200 "swfbutton_keypress",
2210 "sybase_affected_rows",
2211 "sybase_affected_rows",
2218 "sybase_fetch_array",
2219 "sybase_fetch_array",
2220 "sybase_fetch_field",
2221 "sybase_fetch_field",
2222 "sybase_fetch_object",
2223 "sybase_fetch_object",
2226 "sybase_field_seek",
2227 "sybase_field_seek",
2228 "sybase_free_result",
2229 "sybase_free_result",
2230 "sybase_get_last_message",
2231 "sybase_get_last_message",
2232 "sybase_min_client_severity",
2233 "sybase_min_error_severity",
2234 "sybase_min_message_severity",
2235 "sybase_min_server_severity",
2236 "sybase_num_fields",
2237 "sybase_num_fields",
2263 "udm_add_search_limit",
2266 "udm_clear_search_limits",
2271 "udm_free_ispell_data",
2273 "udm_get_doc_count",
2274 "udm_get_res_field",
2275 "udm_get_res_param",
2276 "udm_load_ispell_data",
2277 "udm_set_agent_param",
2285 "unregister_tick_function",
2295 "velocis_autocommit",
2301 "velocis_fieldname",
2303 "velocis_freeresult",
2304 "velocis_off_autocommit",
2308 "vpopmail_add_alias_domain",
2309 "vpopmail_add_alias_domain_ex",
2310 "vpopmail_add_domain",
2311 "vpopmail_add_domain_ex",
2312 "vpopmail_add_user",
2313 "vpopmail_auth_user",
2314 "vpopmail_del_domain",
2315 "vpopmail_del_domain_ex",
2316 "vpopmail_del_user",
2319 "vpopmail_set_user_quota",
2323 "wddx_packet_start",
2324 "wddx_serialize_value",
2325 "wddx_serialize_vars",
2330 "xml_get_current_byte_index",
2331 "xml_get_current_column_number",
2332 "xml_get_current_line_number",
2333 "xml_get_error_code",
2335 "xml_parse_into_struct",
2336 "xml_parser_create",
2337 "xml_parser_create_ns",
2339 "xml_parser_get_option",
2340 "xml_parser_set_option",
2341 "xml_set_character_data_handler",
2342 "xml_set_default_handler",
2343 "xml_set_element_handler",
2344 "xml_set_end_namespace_decl_handler",
2345 "xml_set_external_entity_ref_handler",
2346 "xml_set_notation_decl_handler",
2348 "xml_set_processing_instruction_handler",
2349 "xml_set_start_namespace_decl_handler",
2350 "xml_set_unparsed_entity_decl_handler",
2355 "xpath_eval_expression",
2361 "xslt_fetch_result",
2364 "xslt_output_begintransform",
2365 "xslt_output_endtransform",
2369 "xslt_set_encoding",
2370 "xslt_set_error_handler",
2371 "xslt_set_sax_handler",
2372 "xslt_set_scheme_handler",
2398 "yp_get_default_domain",
2408 "zzip_entry_compressedsize",
2409 "zzip_entry_compressionmethod",
2410 "zzip_entry_filesize",
2417 private IToken variable;
2419 private class PHPWordRule extends WordRule {
2420 private StringBuffer fBuffer= new StringBuffer();
2422 public PHPWordRule(IWordDetector detector) {
2423 super(detector, Token.UNDEFINED);
2426 public PHPWordRule(IWordDetector detector, IToken defaultToken) {
2427 super(detector, defaultToken);
2430 public IToken evaluate(ICharacterScanner scanner) {
2431 int c = scanner.read();
2432 boolean isVariable = false;
2433 if (fDetector.isWordStart((char) c)) {
2437 if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) {
2439 fBuffer.setLength(0);
2441 fBuffer.append((char) c);
2443 } while (c != scanner.EOF && fDetector.isWordPart((char) c));
2449 IToken token = (IToken) fWords.get(fBuffer.toString());
2453 if (fDefaultToken.isUndefined())
2454 unreadBuffer(scanner);
2456 return fDefaultToken;
2461 return Token.UNDEFINED;
2465 private static String[] fgConstants = { "__LINE__", "__FILE__", "true", "false" };
2466 private TextAttribute fComment;
2467 private TextAttribute fKeyword;
2468 private TextAttribute fType;
2469 private TextAttribute fString;
2470 private PHPColorProvider fColorProvider;
2473 * Creates a Java code scanner
2475 public PHPCodeScanner(PHPColorProvider provider) {
2477 IToken keyword = new Token(new TextAttribute(provider.getColor(PHPColorProvider.KEYWORD)));
2478 IToken type = new Token(new TextAttribute(provider.getColor(PHPColorProvider.TYPE)));
2479 IToken string = new Token(new TextAttribute(provider.getColor(PHPColorProvider.STRING)));
2480 IToken comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.SINGLE_LINE_COMMENT)));
2481 IToken multi_comment = new Token(new TextAttribute(provider.getColor(PHPColorProvider.MULTI_LINE_COMMENT)));
2482 IToken other = new Token(new TextAttribute(provider.getColor(PHPColorProvider.DEFAULT)));
2484 variable = new Token(new TextAttribute(provider.getColor(PHPColorProvider.VARIABLE)));
2487 List rules = new ArrayList();
2489 // Add rule for single line comments.
2490 rules.add(new EndOfLineRule("//", comment)); //$NON-NLS-1$
2491 // EndOfLineRule endOfLine = new EndOfLineRule("#", comment);
2492 // endOfLine.setColumnConstraint(0);
2493 rules.add(new EndOfLineRule("#", comment));
2495 // Add rule for strings and character constants.
2496 rules.add(new SingleLineRule("\"", "\"", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
2497 rules.add(new SingleLineRule("'", "'", string, '\\')); //$NON-NLS-2$ //$NON-NLS-1$
2499 // rules.add(new SingleLineRule("//", "//", php_comment));
2500 rules.add(new MultiLineRule("/*", "*/", multi_comment));
2502 // Add generic whitespace rule.
2503 rules.add(new WhitespaceRule(new PHPWhitespaceDetector()));
2505 // Add word rule for keywords, types, and constants.
2506 PHPWordRule wordRule = new PHPWordRule(new PHPWordDetector(), other);
2507 for (int i = 0; i < fgKeywords.length; i++)
2508 wordRule.addWord(fgKeywords[i], keyword);
2509 for (int i = 0; i < fgFunctionNames.length; i++)
2510 wordRule.addWord(fgFunctionNames[i], type);
2511 for (int i = 0; i < fgConstants.length; i++)
2512 wordRule.addWord(fgConstants[i], type);
2513 rules.add(wordRule);
2515 IRule[] result = new IRule[rules.size()];
2516 rules.toArray(result);