1 /* ANSI-C code produced by gperf version 2.7.2 */
2 /* Command-line: gperf -L ANSI-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, 2001, 2002, 2003
5 Free Software Foundation, Inc.
6 Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
8 This file is part of GCC.
10 GCC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GCC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GCC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA.
25 Java and all Java-based marks are trademarks or registered trademarks
26 of Sun Microsystems, Inc. in the United States and other countries.
27 The Free Software Foundation is independent of Sun Microsystems, Inc. */
29 struct java_keyword
{ const char *const name
; const int token
; };
33 static unsigned int hash (const char *, unsigned int);
37 const struct java_keyword
*java_keyword (const char *, unsigned int);
39 #define TOTAL_KEYWORDS 52
40 #define MIN_WORD_LENGTH 2
41 #define MAX_WORD_LENGTH 12
42 #define MIN_HASH_VALUE 7
43 #define MAX_HASH_VALUE 85
44 /* maximum key range = 79, duplicates = 0 */
54 hash (const char *str
, unsigned int len
)
56 static const unsigned char asso_values
[] =
58 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
59 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
60 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
61 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
62 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
63 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
64 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
65 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
66 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
67 86, 86, 86, 86, 86, 86, 86, 1, 34, 3,
68 1, 1, 18, 7, 21, 28, 86, 14, 1, 86,
69 18, 20, 37, 86, 15, 6, 2, 5, 40, 36,
70 86, 36, 86, 86, 86, 86, 86, 86, 86, 86,
71 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
72 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
73 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
74 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
75 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
76 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
77 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
78 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
79 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
80 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
81 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
82 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
83 86, 86, 86, 86, 86, 86
91 hval
+= asso_values
[(unsigned char)str
[3]];
95 hval
+= asso_values
[(unsigned char)str
[0]];
98 return hval
+ asso_values
[(unsigned char)str
[len
- 1]];
104 const struct java_keyword
*
105 java_keyword (const char *str
, unsigned int len
)
107 static const struct java_keyword wordlist
[] =
109 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
114 {"assert", ASSERT_TK
},
115 {"default", DEFAULT_TK
},
117 {"abstract", ABSTRACT_TK
},
118 {"continue", CONTINUE_TK
},
119 {"extends", EXTENDS_TK
},
121 {"static", STATIC_TK
},
126 {"synchronized", SYNCHRONIZED_TK
},
135 {"transient", TRANSIENT_TK
},
138 {"throws", THROWS_TK
},
139 {"switch", SWITCH_TK
},
143 {"interface", INTERFACE_TK
},
146 {"double", DOUBLE_TK
},
148 {"return", RETURN_TK
},
149 {"implements", IMPLEMENTS_TK
},
151 {"public", PUBLIC_TK
},
153 {"protected", PROTECTED_TK
},
154 {"volatile", VOLATILE_TK
},
157 {"native", NATIVE_TK
},
160 {"import", IMPORT_TK
},
162 {"instanceof", INSTANCEOF_TK
},
163 {"package", PACKAGE_TK
},
164 {"boolean", BOOLEAN_TK
},
166 {"finally", FINALLY_TK
},
168 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
169 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
170 {"", 0}, {"", 0}, {"", 0},
171 {"strictfp", STRICT_TK
},
172 {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
173 {"private", PRIVATE_TK
}
176 if (len
<= MAX_WORD_LENGTH
&& len
>= MIN_WORD_LENGTH
)
178 int key
= hash (str
, len
);
180 if (key
<= MAX_HASH_VALUE
&& key
>= 0)
182 const char *s
= wordlist
[key
].name
;
184 if (*str
== *s
&& !strcmp (str
+ 1, s
+ 1))
185 return &wordlist
[key
];