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)
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; };
32 static unsigned int hash PARAMS ((const char *, unsigned int));
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 */
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;
92 hval += asso_values[(unsigned char)str[3]];
96 hval += asso_values[(unsigned char)str[0]];
99 return hval + asso_values[(unsigned char)str[len - 1]];
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},
118 {"public", PUBLIC_TK},
120 {"protected", PROTECTED_TK},
121 {"continue", CONTINUE_TK},
122 {"extends", EXTENDS_TK},
124 {"static", STATIC_TK},
126 {"default", DEFAULT_TK},
128 {"abstract", ABSTRACT_TK},
129 {"synchronized", SYNCHRONIZED_TK},
132 {"double", DOUBLE_TK},
136 {"switch", SWITCH_TK},
137 {"package", PACKAGE_TK},
147 {"interface", INTERFACE_TK},
150 {"finally", FINALLY_TK},
151 {"strictfp", STRICT_TK},
153 {"implements", IMPLEMENTS_TK},
155 {"transient", TRANSIENT_TK},
157 {"private", PRIVATE_TK},
160 {"throws", THROWS_TK},
164 {"return", RETURN_TK},
166 {"volatile", VOLATILE_TK},
167 {"boolean", BOOLEAN_TK},
168 {"instanceof", INSTANCEOF_TK},
171 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 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},
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];