/* */
This source file includes following definitions.
- c_hash
- c_lookup
- c_reserved_word
- c_reserved_sharp
- c_reserved_yacc
1 /* ANSI-C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf --language=ANSI-C --struct-type --slot-name=name --hash-fn-name=c_hash --lookup-fn-name=c_lookup */
3 /* Computed positions: -k'1-2,4,6-9,12,14' */
4
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30 #endif
31
32
33 #include "strmake.h"
34 #define START_VARIABLE 1001
35 #define START_WORD 2001
36 #define START_SHARP 3001
37 #define START_YACC 4001
38 #define IS_RESERVED_WORD(a) ((a) >= START_WORD)
39 #define IS_RESERVED_VARIABLE(a) ((a) >= START_VARIABLE && (a) < START_WORD)
40 #define IS_RESERVED_SHARP(a) ((a) >= START_SHARP && (a) < START_YACC)
41 #define IS_RESERVED_YACC(a) ((a) >= START_YACC)
42
43 #define C___P 2001
44 #define C___ATTRIBUTE__ 2002
45 #define C___EXTENSION__ 2003
46 #define C_ASM 2004
47 #define C_CONST 2005
48 #define C_INLINE 2006
49 #define C_RESTRICT 2007
50 #define C_SIGNED 2008
51 #define C_VOLATILE 2009
52 #define C__ALIGNAS 2010
53 #define C__ALIGNOF 2011
54 #define C__ATOMIC 2012
55 #define C__BOOL 2013
56 #define C__COMPLEX 2014
57 #define C__GENERIC 2015
58 #define C__IMAGINARY 2016
59 #define C__NORETURN 2017
60 #define C__STATIC_ASSERT 2018
61 #define C__THREAD_LOCAL 2019
62 #define C_AUTO 2020
63 #define C_BREAK 2021
64 #define C_CASE 2022
65 #define C_CHAR 2023
66 #define C_CONTINUE 2024
67 #define C_DEFAULT 2025
68 #define C_DO 2026
69 #define C_DOUBLE 2027
70 #define C_ELSE 2028
71 #define C_ENUM 2029
72 #define C_EXTERN 2030
73 #define C_FLOAT 2031
74 #define C_FOR 2032
75 #define C_GOTO 2033
76 #define C_IF 2034
77 #define C_INT 2035
78 #define C_LONG 2036
79 #define C_REGISTER 2037
80 #define C_RETURN 2038
81 #define C_SHORT 2039
82 #define C_SIZEOF 2040
83 #define C_STATIC 2041
84 #define C_STRUCT 2042
85 #define C_SWITCH 2043
86 #define C_TYPEDEF 2044
87 #define C_UNION 2045
88 #define C_UNSIGNED 2046
89 #define C_VOID 2047
90 #define C_WHILE 2048
91 #define SHARP_SHARP 3001
92 #define SHARP_ASSERT 3002
93 #define SHARP_DEFINE 3003
94 #define SHARP_ELIF 3004
95 #define SHARP_ELSE 3005
96 #define SHARP_ENDIF 3006
97 #define SHARP_ERROR 3007
98 #define SHARP_IDENT 3008
99 #define SHARP_IF 3009
100 #define SHARP_IFDEF 3010
101 #define SHARP_IFNDEF 3011
102 #define SHARP_IMPORT 3012
103 #define SHARP_INCLUDE 3013
104 #define SHARP_INCLUDE_NEXT 3014
105 #define SHARP_LINE 3015
106 #define SHARP_PRAGMA 3016
107 #define SHARP_SCCS 3017
108 #define SHARP_UNASSERT 3018
109 #define SHARP_UNDEF 3019
110 #define SHARP_WARNING 3020
111 #define YACC_SEP 4001
112 #define YACC_DEBUG 4002
113 #define YACC_DEFAULT_PREC 4003
114 #define YACC_DEFINE 4004
115 #define YACC_DEFINES 4005
116 #define YACC_DESTRUCTOR 4006
117 #define YACC_DPREC 4007
118 #define YACC_ERROR_VERBOSE 4008
119 #define YACC_EXPECT 4009
120 #define YACC_EXPECT_RR 4010
121 #define YACC_FILE_PREFIX 4011
122 #define YACC_GLR_PARSER 4012
123 #define YACC_INITIAL_ACTION 4013
124 #define YACC_LEFT 4014
125 #define YACC_LEX_PARAM 4015
126 #define YACC_LOCATIONS 4016
127 #define YACC_MERGE 4017
128 #define YACC_NAME_PREFIX 4018
129 #define YACC_NO_DEFAULT_PREC 4019
130 #define YACC_NO_LINES 4020
131 #define YACC_NONASSOC 4021
132 #define YACC_NONDETERMINISTIC_PARSER 4022
133 #define YACC_NTERM 4023
134 #define YACC_OUTPUT 4024
135 #define YACC_PARSE_PARAM 4025
136 #define YACC_PREC 4026
137 #define YACC_PRINTER 4027
138 #define YACC_PURE_PARSER 4028
139 #define YACC_REQUIRE 4029
140 #define YACC_RIGHT 4030
141 #define YACC_SKELETON 4031
142 #define YACC_START 4032
143 #define YACC_TOKEN 4033
144 #define YACC_TOKEN_TABLE 4034
145 #define YACC_TYPE 4035
146 #define YACC_UNION 4036
147 #define YACC_VERBOSE 4037
148 #define YACC_YACC 4038
149 #define YACC_BEGIN 4039
150 #define YACC_END 4040
151 struct keyword { char *name; int token; };
152
153 #define TOTAL_KEYWORDS 142
154 #define MIN_WORD_LENGTH 2
155 #define MAX_WORD_LENGTH 24
156 #define MIN_HASH_VALUE 3
157 #define MAX_HASH_VALUE 352
158 /* maximum key range = 350, duplicates = 0 */
159
160 #ifdef __GNUC__
161 __inline
162 #else
163 #ifdef __cplusplus
164 inline
165 #endif
166 #endif
167 static unsigned int
168 c_hash (register const char *str, register unsigned int len)
169 {
170 static unsigned short asso_values[] =
171 {
172 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
173 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
174 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
175 353, 353, 353, 353, 353, 10, 353, 25, 353, 353,
176 353, 353, 353, 353, 353, 10, 55, 353, 353, 353,
177 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
178 353, 353, 353, 353, 353, 15, 5, 0, 353, 353,
179 353, 20, 353, 0, 353, 353, 353, 353, 5, 353,
180 353, 353, 353, 5, 0, 353, 353, 353, 353, 353,
181 353, 353, 353, 353, 353, 0, 30, 0, 105, 30,
182 10, 0, 5, 25, 50, 5, 353, 5, 105, 115,
183 0, 30, 75, 0, 50, 30, 5, 25, 0, 10,
184 15, 65, 353, 50, 353, 35, 353, 353, 353, 353,
185 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
186 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
187 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
188 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
189 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
190 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
191 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
192 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
193 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
194 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
195 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
196 353, 353, 353, 353, 353, 353, 353, 353, 353, 353,
197 353, 353, 353, 353, 353, 353, 353
198 };
199 register int hval = len;
200
201 switch (hval)
202 {
203 default:
204 hval += asso_values[(unsigned char)str[13]+1];
205 /*FALLTHROUGH*/
206 case 13:
207 case 12:
208 hval += asso_values[(unsigned char)str[11]+1];
209 /*FALLTHROUGH*/
210 case 11:
211 case 10:
212 case 9:
213 hval += asso_values[(unsigned char)str[8]];
214 /*FALLTHROUGH*/
215 case 8:
216 hval += asso_values[(unsigned char)str[7]];
217 /*FALLTHROUGH*/
218 case 7:
219 hval += asso_values[(unsigned char)str[6]];
220 /*FALLTHROUGH*/
221 case 6:
222 hval += asso_values[(unsigned char)str[5]];
223 /*FALLTHROUGH*/
224 case 5:
225 case 4:
226 hval += asso_values[(unsigned char)str[3]];
227 /*FALLTHROUGH*/
228 case 3:
229 case 2:
230 hval += asso_values[(unsigned char)str[1]];
231 /*FALLTHROUGH*/
232 case 1:
233 hval += asso_values[(unsigned char)str[0]];
234 break;
235 }
236 return hval;
237 }
238
239 #ifdef __GNUC__
240 __inline
241 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
242 __attribute__ ((__gnu_inline__))
243 #endif
244 #endif
245 struct keyword *
246 c_lookup (register const char *str, register unsigned int len)
247 {
248 static struct keyword wordlist[] =
249 {
250 {""}, {""}, {""},
251 {"__P", C___P},
252 {""}, {""}, {""}, {""},
253 {"int", C_INT},
254 {""}, {""}, {""},
255 {"if", C_IF},
256 {"__inline", C_INLINE},
257 {""},
258 {"__inline__", C_INLINE},
259 {"inline", C_INLINE},
260 {""},
261 {"#if", SHARP_IF},
262 {""},
263 {"#elif", SHARP_ELIF},
264 {"extern", C_EXTERN},
265 {"##", SHARP_SHARP},
266 {"__signed", C_SIGNED},
267 {""},
268 {"__signed__", C_SIGNED},
269 {"#ident", SHARP_IDENT},
270 {"#ifndef", SHARP_IFNDEF},
271 {""}, {""}, {""},
272 {"#endif", SHARP_ENDIF},
273 {"#define", SHARP_DEFINE},
274 {"asm", C_ASM},
275 {"case", C_CASE},
276 {"__asm", C_ASM},
277 {"#ifdef", SHARP_IFDEF},
278 {"__asm__", C_ASM},
279 {"for", C_FOR},
280 {""},
281 {"_Bool", C__BOOL},
282 {"%token", YACC_TOKEN},
283 {"do", C_DO},
284 {""},
285 {"void", C_VOID},
286 {"#else", SHARP_ELSE},
287 {"sizeof", C_SIZEOF},
288 {"%define", YACC_DEFINE},
289 {"unsigned", C_UNSIGNED},
290 {""}, {""},
291 {"signed", C_SIGNED},
292 {"%%", YACC_SEP},
293 {""}, {""}, {""},
294 {"#undef", SHARP_UNDEF},
295 {"%token_table", YACC_TOKEN_TABLE},
296 {"_Alignas", C__ALIGNAS},
297 {"auto", C_AUTO},
298 {"union", C_UNION},
299 {"%union", YACC_UNION},
300 {"%}", YACC_END},
301 {"_Alignof", C__ALIGNOF},
302 {""},
303 {"_Imaginary", C__IMAGINARY},
304 {"%start", YACC_START},
305 {"%token-table", YACC_TOKEN_TABLE},
306 {"__thread", C__THREAD_LOCAL},
307 {"%no_lines", YACC_NO_LINES},
308 {""},
309 {"struct", C_STRUCT},
310 {"__const", C_CONST},
311 {""},
312 {"__const__", C_CONST},
313 {"#sccs", SHARP_SCCS},
314 {"static", C_STATIC},
315 {"%{", YACC_BEGIN},
316 {"%defines", YACC_DEFINES},
317 {"%no-lines", YACC_NO_LINES},
318 {""},
319 {"return", C_RETURN},
320 {"typedef", C_TYPEDEF},
321 {""},
322 {"_Static_assert", C__STATIC_ASSERT},
323 {"%term", YACC_TOKEN},
324 {""},
325 {"_Atomic", C__ATOMIC},
326 {"#include", SHARP_INCLUDE},
327 {"goto", C_GOTO},
328 {""}, {""}, {""},
329 {"__extension__", C___EXTENSION__},
330 {""},
331 {"const", C_CONST},
332 {""},
333 {"%output", YACC_OUTPUT},
334 {"continue", C_CONTINUE},
335 {"%skeleton", YACC_SKELETON},
336 {"__restrict", C_RESTRICT},
337 {"switch", C_SWITCH},
338 {"#assert", SHARP_ASSERT},
339 {"restrict", C_RESTRICT},
340 {""},
341 {"%prec", YACC_PREC},
342 {""}, {""},
343 {"#warning", SHARP_WARNING},
344 {"else", C_ELSE},
345 {"%type", YACC_TYPE},
346 {"%right", YACC_RIGHT},
347 {""},
348 {"_Generic", C__GENERIC},
349 {""},
350 {"float", C_FLOAT},
351 {"#error", SHARP_ERROR},
352 {""},
353 {"register", C_REGISTER},
354 {"enum", C_ENUM},
355 {"#line", SHARP_LINE},
356 {"%dprec", YACC_DPREC},
357 {""}, {""}, {""},
358 {"%yacc", YACC_YACC},
359 {""},
360 {"default", C_DEFAULT},
361 {""},
362 {"#unassert", SHARP_UNASSERT},
363 {""},
364 {"%no_default_prec", YACC_NO_DEFAULT_PREC},
365 {"__restrict__", C_RESTRICT},
366 {""},
367 {"char", C_CHAR},
368 {"short", C_SHORT},
369 {""}, {""},
370 {"%require", YACC_REQUIRE},
371 {"%nondeterministic-parser", YACC_NONDETERMINISTIC_PARSER},
372 {"%left", YACC_LEFT},
373 {"%no-default_prec", YACC_NO_DEFAULT_PREC},
374 {"%expect", YACC_EXPECT},
375 {"%verbose", YACC_VERBOSE},
376 {"_Noreturn", C__NORETURN},
377 {""},
378 {"%nterm", YACC_NTERM},
379 {""},
380 {"volatile", C_VOLATILE},
381 {""}, {""},
382 {"double", C_DOUBLE},
383 {"#import", SHARP_IMPORT},
384 {""},
385 {"%nonassoc", YACC_NONASSOC},
386 {"__volatile", C_VOLATILE},
387 {"%no_default-prec", YACC_NO_DEFAULT_PREC},
388 {""},
389 {"#include_next", SHARP_INCLUDE_NEXT},
390 {"%fixed_output_files", YACC_YACC},
391 {"break", C_BREAK},
392 {""}, {""}, {""},
393 {"long", C_LONG},
394 {""},
395 {"%no-default-prec", YACC_NO_DEFAULT_PREC},
396 {""},
397 {"%printer", YACC_PRINTER},
398 {"%fixed-output_files", YACC_YACC},
399 {"while", C_WHILE},
400 {"%debug", YACC_DEBUG},
401 {""}, {""},
402 {"__alignof", C__ALIGNOF},
403 {""},
404 {"__alignof__", C__ALIGNOF},
405 {""}, {""}, {""}, {""}, {""}, {""}, {""},
406 {"%fixed_output-files", YACC_YACC},
407 {""},
408 {"%destructor", YACC_DESTRUCTOR},
409 {"__volatile__", C_VOLATILE},
410 {""}, {""}, {""}, {""}, {""},
411 {"%default_prec", YACC_DEFAULT_PREC},
412 {"%fixed-output-files", YACC_YACC},
413 {"%expect_rr", YACC_EXPECT_RR},
414 {"%merge", YACC_MERGE},
415 {""}, {""}, {""}, {""},
416 {"__attribute", C___ATTRIBUTE__},
417 {""},
418 {"%default-prec", YACC_DEFAULT_PREC},
419 {""},
420 {"%expect-rr", YACC_EXPECT_RR},
421 {""},
422 {"#pragma", SHARP_PRAGMA},
423 {""}, {""},
424 {"%locations", YACC_LOCATIONS},
425 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
426 {"%error_verbose", YACC_ERROR_VERBOSE},
427 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
428 {"%error-verbose", YACC_ERROR_VERBOSE},
429 {""}, {""}, {""},
430 {"__attribute__", C___ATTRIBUTE__},
431 {"__complex", C__COMPLEX},
432 {""},
433 {"__complex__", C__COMPLEX},
434 {""}, {""}, {""}, {""}, {""}, {""},
435 {"_Complex", C__COMPLEX},
436 {""}, {""}, {""},
437 {"%parse-param", YACC_PARSE_PARAM},
438 {""}, {""}, {""}, {""},
439 {"%binary", YACC_NONASSOC},
440 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
441 {""}, {""}, {""}, {""},
442 {"%glr-parser", YACC_GLR_PARSER},
443 {""}, {""}, {""},
444 {"%initial-action", YACC_INITIAL_ACTION},
445 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
446 {"%lex-param", YACC_LEX_PARAM},
447 {""}, {""},
448 {"_Thread_local", C__THREAD_LOCAL},
449 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
450 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
451 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
452 {""}, {""}, {""}, {""}, {""}, {""},
453 {"%pure_parser", YACC_PURE_PARSER},
454 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
455 {"%pure-parser", YACC_PURE_PARSER},
456 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
457 {""}, {""}, {""}, {""}, {""},
458 {"%name_prefix", YACC_NAME_PREFIX},
459 {""}, {""}, {""}, {""},
460 {"%file-prefix", YACC_FILE_PREFIX},
461 {""}, {""}, {""}, {""},
462 {"%name-prefix", YACC_NAME_PREFIX}
463 };
464
465 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
466 {
467 register int key = c_hash (str, len);
468
469 if (key <= MAX_HASH_VALUE && key >= 0)
470 {
471 register const char *s = wordlist[key].name;
472
473 if (*str == *s && !strcmp (str + 1, s + 1))
474 return &wordlist[key];
475 }
476 }
477 return 0;
478 }
479
480 int
481 c_reserved_word(const char *str, int len)
482 {
483 struct keyword *keyword;
484
485 keyword = c_lookup(str, len);
486 return (keyword && IS_RESERVED_WORD(keyword->token)) ? keyword->token : 0;
487 }
488 int
489 c_reserved_sharp(const char *str, int len)
490 {
491 struct keyword *keyword;
492
493 /* Delete blanks. Ex. ' # define ' => '#define' */
494 str = strtrim(str, TRIM_ALL, &len);
495
496 keyword = c_lookup(str, len);
497 return (keyword && IS_RESERVED_SHARP(keyword->token)) ? keyword->token : 0;
498 }
499 int
500 c_reserved_yacc(const char *str, int len)
501 {
502 struct keyword *keyword;
503
504 keyword = c_lookup(str, len);
505 return (keyword && IS_RESERVED_YACC(keyword->token)) ? keyword->token : 0;
506 }
/* */