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