1/* C code produced by gperf version 2.7.1 (19981006 egcs) */ 2/* Command-line: gperf -L C -F , 0 -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$ keyword.gperf */ 3/* Keyword definition for the GNU compiler for the Java(TM) language. 4 Copyright (C) 1997, 1998 Free Software Foundation, Inc. 5 Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com) 6 7This file is part of GNU CC. 8 9GNU CC is free software; you can redistribute it and/or modify 10it under the terms of the GNU General Public License as published by 11the Free Software Foundation; either version 2, or (at your option) 12any later version. 13 14GNU CC is distributed in the hope that it will be useful, 15but WITHOUT ANY WARRANTY; without even the implied warranty of 16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17GNU General Public License for more details. 18 19You should have received a copy of the GNU General Public License 20along with GNU CC; see the file COPYING. If not, write to 21the Free Software Foundation, 59 Temple Place - Suite 330, 22Boston, MA 02111-1307, USA. 23 24Java and all Java-based marks are trademarks or registered trademarks 25of Sun Microsystems, Inc. in the United States and other countries. 26The Free Software Foundation is independent of Sun Microsystems, Inc. */ 27 28struct java_keyword { const char *name; int token; }; 29 30#define TOTAL_KEYWORDS 50 31#define MIN_WORD_LENGTH 2 32#define MAX_WORD_LENGTH 12 33#define MIN_HASH_VALUE 6 34#define MAX_HASH_VALUE 86 35/* maximum key range = 81, duplicates = 0 */ 36 37#ifdef __GNUC__ 38__inline 39#endif 40static unsigned int 41hash (str, len) 42 register const char *str; 43 register unsigned int len; 44{ 45 static unsigned char asso_values[] = 46 { 47 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 48 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 49 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 50 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 51 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 52 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 53 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 54 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 55 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 56 87, 87, 87, 87, 87, 87, 87, 18, 37, 38, 57 27, 1, 30, 3, 12, 8, 87, 2, 11, 87, 58 8, 1, 5, 87, 24, 1, 1, 30, 2, 36, 59 87, 1, 87, 87, 87, 87, 87, 87, 87, 87, 60 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 61 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 62 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 63 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 64 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 65 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 66 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 67 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 68 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 69 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 70 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 71 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 72 87, 87, 87, 87, 87, 87 73 }; 74 register int hval = len; 75 76 switch (hval) 77 { 78 default: 79 case 3: 80 hval += asso_values[(unsigned char)str[2]]; 81 case 2: 82 case 1: 83 hval += asso_values[(unsigned char)str[0]]; 84 break; 85 } 86 return hval + asso_values[(unsigned char)str[len - 1]]; 87} 88 89#ifdef __GNUC__ 90__inline 91#endif 92struct java_keyword * 93java_keyword (str, len) 94 register const char *str; 95 register unsigned int len; 96{ 97 static struct java_keyword wordlist[] = 98 { 99 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, 100 {"try", TRY_TK}, 101 {"else", ELSE_TK}, 102 {"short", SHORT_TK}, 103 {"goto", GOTO_TK}, 104 {"extends", EXTENDS_TK}, 105 {"", 0}, {"", 0}, 106 {"int", INT_TK}, 107 {"this", THIS_TK}, 108 {"", 0}, 109 {"native", NATIVE_TK}, 110 {"", 0}, {"", 0}, 111 {"interface", INTERFACE_TK}, 112 {"import", IMPORT_TK}, 113 {"private", PRIVATE_TK}, 114 {"volatile", VOLATILE_TK}, 115 {"", 0}, 116 {"implements", IMPLEMENTS_TK}, 117 {"", 0}, 118 {"long", LONG_TK}, 119 {"switch", SWITCH_TK}, 120 {"abstract", ABSTRACT_TK}, 121 {"transient", TRANSIENT_TK}, 122 {"do", DO_TK}, 123 {"", 0}, 124 {"throws", THROWS_TK}, 125 {"", 0}, 126 {"null", NULL_TK}, 127 {"super", SUPER_TK}, 128 {"true", TRUE_TK}, 129 {"float", FLOAT_TK}, 130 {"", 0}, 131 {"return", RETURN_TK}, 132 {"if", IF_TK}, 133 {"void", VOID_TK}, 134 {"protected", PROTECTED_TK}, 135 {"byte", BYTE_TK}, 136 {"case", CASE_TK}, 137 {"break", BREAK_TK}, 138 {"finally", FINALLY_TK}, 139 {"false", FALSE_TK}, 140 {"synchronized", SYNCHRONIZED_TK}, 141 {"instanceof", INSTANCEOF_TK}, 142 {"while", WHILE_TK}, 143 {"package", PACKAGE_TK}, 144 {"const", CONST_TK}, 145 {"boolean", BOOLEAN_TK}, 146 {"final", FINAL_TK}, 147 {"continue", CONTINUE_TK}, 148 {"catch", CATCH_TK}, 149 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, 150 {"class", CLASS_TK}, 151 {"static", STATIC_TK}, 152 {"double", DOUBLE_TK}, 153 {"default", DEFAULT_TK}, 154 {"throw", THROW_TK}, 155 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, 156 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, 157 {"for", FOR_TK}, 158 {"", 0}, 159 {"new", NEW_TK}, 160 {"char", CHAR_TK}, 161 {"", 0}, 162 {"public", PUBLIC_TK} 163 }; 164 165 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 166 { 167 register int key = hash (str, len); 168 169 if (key <= MAX_HASH_VALUE && key >= 0) 170 { 171 register const char *s = wordlist[key].name; 172 173 if (*str == *s && !strcmp (str + 1, s + 1)) 174 return &wordlist[key]; 175 } 176 } 177 return 0; 178} 179