361b9d971df8114b79022661a36e9bb9e3b21492
[gcc.git] / gcc / c-gperf.h
1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ ./c-parse.gperf */
3 /* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
4 struct resword { char *name; short token; enum rid rid; };
5
6 #define TOTAL_KEYWORDS 79
7 #define MIN_WORD_LENGTH 2
8 #define MAX_WORD_LENGTH 20
9 #define MIN_HASH_VALUE 10
10 #define MAX_HASH_VALUE 144
11 /* maximum key range = 135, duplicates = 0 */
12
13 #ifdef __GNUC__
14 inline
15 #endif
16 static unsigned int
17 hash (str, len)
18 register char *str;
19 register int unsigned len;
20 {
21 static unsigned char asso_values[] =
22 {
23 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
24 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
25 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
26 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
27 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
28 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
29 145, 145, 145, 145, 25, 145, 145, 145, 145, 145,
30 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
31 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
32 145, 145, 145, 145, 145, 1, 145, 46, 8, 15,
33 61, 6, 36, 48, 3, 5, 145, 18, 63, 25,
34 29, 76, 1, 145, 13, 2, 1, 51, 37, 9,
35 9, 1, 3, 145, 145, 145, 145, 145,
36 };
37 register int hval = len;
38
39 switch (hval)
40 {
41 default:
42 case 3:
43 hval += asso_values[str[2]];
44 case 2:
45 case 1:
46 hval += asso_values[str[0]];
47 break;
48 }
49 return hval + asso_values[str[len - 1]];
50 }
51
52 static struct resword wordlist[] =
53 {
54 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
55 {"",},
56 {"int", TYPESPEC, RID_INT},
57 {"",}, {"",},
58 {"__typeof__", TYPEOF, NORID},
59 {"__signed__", TYPESPEC, RID_SIGNED},
60 {"__imag__", IMAGPART, NORID},
61 {"switch", SWITCH, NORID},
62 {"__inline__", SCSPEC, RID_INLINE},
63 {"else", ELSE, NORID},
64 {"__iterator__", SCSPEC, RID_ITERATOR},
65 {"__inline", SCSPEC, RID_INLINE},
66 {"__extension__", EXTENSION, NORID},
67 {"struct", STRUCT, NORID},
68 {"__real__", REALPART, NORID},
69 {"__const", TYPE_QUAL, RID_CONST},
70 {"while", WHILE, NORID},
71 {"__const__", TYPE_QUAL, RID_CONST},
72 {"case", CASE, NORID},
73 {"__complex__", TYPESPEC, RID_COMPLEX},
74 {"__iterator", SCSPEC, RID_ITERATOR},
75 {"bycopy", TYPE_QUAL, RID_BYCOPY},
76 {"",}, {"",}, {"",},
77 {"__complex", TYPESPEC, RID_COMPLEX},
78 {"",},
79 {"in", TYPE_QUAL, RID_IN},
80 {"break", BREAK, NORID},
81 {"@defs", DEFS, NORID},
82 {"",}, {"",}, {"",},
83 {"extern", SCSPEC, RID_EXTERN},
84 {"if", IF, NORID},
85 {"typeof", TYPEOF, NORID},
86 {"typedef", SCSPEC, RID_TYPEDEF},
87 {"__typeof", TYPEOF, NORID},
88 {"sizeof", SIZEOF, NORID},
89 {"",},
90 {"return", RETURN, NORID},
91 {"const", TYPE_QUAL, RID_CONST},
92 {"__volatile__", TYPE_QUAL, RID_VOLATILE},
93 {"@private", PRIVATE, NORID},
94 {"@selector", SELECTOR, NORID},
95 {"__volatile", TYPE_QUAL, RID_VOLATILE},
96 {"__asm__", ASM_KEYWORD, NORID},
97 {"",}, {"",},
98 {"continue", CONTINUE, NORID},
99 {"__alignof__", ALIGNOF, NORID},
100 {"__imag", IMAGPART, NORID},
101 {"__attribute__", ATTRIBUTE, NORID},
102 {"",}, {"",},
103 {"__attribute", ATTRIBUTE, NORID},
104 {"for", FOR, NORID},
105 {"",},
106 {"@encode", ENCODE, NORID},
107 {"id", OBJECTNAME, RID_ID},
108 {"static", SCSPEC, RID_STATIC},
109 {"@interface", INTERFACE, NORID},
110 {"",},
111 {"__signed", TYPESPEC, RID_SIGNED},
112 {"",},
113 {"__label__", LABEL, NORID},
114 {"",}, {"",},
115 {"__asm", ASM_KEYWORD, NORID},
116 {"char", TYPESPEC, RID_CHAR},
117 {"",},
118 {"inline", SCSPEC, RID_INLINE},
119 {"out", TYPE_QUAL, RID_OUT},
120 {"register", SCSPEC, RID_REGISTER},
121 {"__real", REALPART, NORID},
122 {"short", TYPESPEC, RID_SHORT},
123 {"",},
124 {"enum", ENUM, NORID},
125 {"inout", TYPE_QUAL, RID_INOUT},
126 {"",},
127 {"oneway", TYPE_QUAL, RID_ONEWAY},
128 {"union", UNION, NORID},
129 {"",},
130 {"__alignof", ALIGNOF, NORID},
131 {"",},
132 {"@implementation", IMPLEMENTATION, NORID},
133 {"",},
134 {"@class", CLASS, NORID},
135 {"",},
136 {"@public", PUBLIC, NORID},
137 {"asm", ASM_KEYWORD, NORID},
138 {"",}, {"",}, {"",}, {"",}, {"",},
139 {"default", DEFAULT, NORID},
140 {"",},
141 {"void", TYPESPEC, RID_VOID},
142 {"",},
143 {"@protected", PROTECTED, NORID},
144 {"@protocol", PROTOCOL, NORID},
145 {"",}, {"",}, {"",},
146 {"volatile", TYPE_QUAL, RID_VOLATILE},
147 {"",}, {"",},
148 {"signed", TYPESPEC, RID_SIGNED},
149 {"float", TYPESPEC, RID_FLOAT},
150 {"@end", END, NORID},
151 {"",}, {"",},
152 {"unsigned", TYPESPEC, RID_UNSIGNED},
153 {"@compatibility_alias", ALIAS, NORID},
154 {"double", TYPESPEC, RID_DOUBLE},
155 {"",}, {"",},
156 {"auto", SCSPEC, RID_AUTO},
157 {"",},
158 {"goto", GOTO, NORID},
159 {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
160 {"do", DO, NORID},
161 {"",}, {"",}, {"",}, {"",},
162 {"long", TYPESPEC, RID_LONG},
163 };
164
165 #ifdef __GNUC__
166 inline
167 #endif
168 struct resword *
169 is_reserved_word (str, len)
170 register char *str;
171 register unsigned int len;
172 {
173 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
174 {
175 register int key = hash (str, len);
176
177 if (key <= MAX_HASH_VALUE && key >= 0)
178 {
179 register char *s = wordlist[key].name;
180
181 if (*s == *str && !strcmp (str + 1, s + 1))
182 return &wordlist[key];
183 }
184 }
185 return 0;
186 }