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