1 /* ANSI-C code produced by gperf version 3.1 */
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-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
c_hash(register const char * str,register size_t len)168 c_hash (register const char *str, register size_t 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 unsigned 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 struct keyword *
c_lookup(register const char * str,register size_t len)240 c_lookup (register const char *str, register size_t len)
241 {
242   static struct keyword wordlist[] =
243     {
244       {""}, {""}, {""},
245       {"__P", C___P},
246       {""}, {""}, {""}, {""},
247       {"int", C_INT},
248       {""}, {""}, {""},
249       {"if", C_IF},
250       {"__inline", C_INLINE},
251       {""},
252       {"__inline__", C_INLINE},
253       {"inline", C_INLINE},
254       {""},
255       {"#if", SHARP_IF},
256       {""},
257       {"#elif", SHARP_ELIF},
258       {"extern", C_EXTERN},
259       {"##", SHARP_SHARP},
260       {"__signed", C_SIGNED},
261       {""},
262       {"__signed__", C_SIGNED},
263       {"#ident", SHARP_IDENT},
264       {"#ifndef", SHARP_IFNDEF},
265       {""}, {""}, {""},
266       {"#endif", SHARP_ENDIF},
267       {"#define", SHARP_DEFINE},
268       {"asm", C_ASM},
269       {"case", C_CASE},
270       {"__asm", C_ASM},
271       {"#ifdef", SHARP_IFDEF},
272       {"__asm__", C_ASM},
273       {"for", C_FOR},
274       {""},
275       {"_Bool", C__BOOL},
276       {"%token", YACC_TOKEN},
277       {"do", C_DO},
278       {""},
279       {"void", C_VOID},
280       {"#else", SHARP_ELSE},
281       {"sizeof", C_SIZEOF},
282       {"%define", YACC_DEFINE},
283       {"unsigned", C_UNSIGNED},
284       {""}, {""},
285       {"signed", C_SIGNED},
286       {"%%", YACC_SEP},
287       {""}, {""}, {""},
288       {"#undef", SHARP_UNDEF},
289       {"%token_table", YACC_TOKEN_TABLE},
290       {"_Alignas", C__ALIGNAS},
291       {"auto", C_AUTO},
292       {"union", C_UNION},
293       {"%union", YACC_UNION},
294       {"%}", YACC_END},
295       {"_Alignof", C__ALIGNOF},
296       {""},
297       {"_Imaginary", C__IMAGINARY},
298       {"%start", YACC_START},
299       {"%token-table", YACC_TOKEN_TABLE},
300       {"__thread", C__THREAD_LOCAL},
301       {"%no_lines", YACC_NO_LINES},
302       {""},
303       {"struct", C_STRUCT},
304       {"__const", C_CONST},
305       {""},
306       {"__const__", C_CONST},
307       {"#sccs", SHARP_SCCS},
308       {"static", C_STATIC},
309       {"%{", YACC_BEGIN},
310       {"%defines", YACC_DEFINES},
311       {"%no-lines", YACC_NO_LINES},
312       {""},
313       {"return", C_RETURN},
314       {"typedef", C_TYPEDEF},
315       {""},
316       {"_Static_assert", C__STATIC_ASSERT},
317       {"%term", YACC_TOKEN},
318       {""},
319       {"_Atomic", C__ATOMIC},
320       {"#include", SHARP_INCLUDE},
321       {"goto", C_GOTO},
322       {""}, {""}, {""},
323       {"__extension__", C___EXTENSION__},
324       {""},
325       {"const", C_CONST},
326       {""},
327       {"%output", YACC_OUTPUT},
328       {"continue", C_CONTINUE},
329       {"%skeleton", YACC_SKELETON},
330       {"__restrict", C_RESTRICT},
331       {"switch", C_SWITCH},
332       {"#assert", SHARP_ASSERT},
333       {"restrict", C_RESTRICT},
334       {""},
335       {"%prec", YACC_PREC},
336       {""}, {""},
337       {"#warning", SHARP_WARNING},
338       {"else", C_ELSE},
339       {"%type", YACC_TYPE},
340       {"%right", YACC_RIGHT},
341       {""},
342       {"_Generic", C__GENERIC},
343       {""},
344       {"float", C_FLOAT},
345       {"#error", SHARP_ERROR},
346       {""},
347       {"register", C_REGISTER},
348       {"enum", C_ENUM},
349       {"#line", SHARP_LINE},
350       {"%dprec", YACC_DPREC},
351       {""}, {""}, {""},
352       {"%yacc", YACC_YACC},
353       {""},
354       {"default", C_DEFAULT},
355       {""},
356       {"#unassert", SHARP_UNASSERT},
357       {""},
358       {"%no_default_prec", YACC_NO_DEFAULT_PREC},
359       {"__restrict__", C_RESTRICT},
360       {""},
361       {"char", C_CHAR},
362       {"short", C_SHORT},
363       {""}, {""},
364       {"%require", YACC_REQUIRE},
365       {"%nondeterministic-parser", YACC_NONDETERMINISTIC_PARSER},
366       {"%left", YACC_LEFT},
367       {"%no-default_prec", YACC_NO_DEFAULT_PREC},
368       {"%expect", YACC_EXPECT},
369       {"%verbose", YACC_VERBOSE},
370       {"_Noreturn", C__NORETURN},
371       {""},
372       {"%nterm", YACC_NTERM},
373       {""},
374       {"volatile", C_VOLATILE},
375       {""}, {""},
376       {"double", C_DOUBLE},
377       {"#import", SHARP_IMPORT},
378       {""},
379       {"%nonassoc", YACC_NONASSOC},
380       {"__volatile", C_VOLATILE},
381       {"%no_default-prec", YACC_NO_DEFAULT_PREC},
382       {""},
383       {"#include_next", SHARP_INCLUDE_NEXT},
384       {"%fixed_output_files", YACC_YACC},
385       {"break", C_BREAK},
386       {""}, {""}, {""},
387       {"long", C_LONG},
388       {""},
389       {"%no-default-prec", YACC_NO_DEFAULT_PREC},
390       {""},
391       {"%printer", YACC_PRINTER},
392       {"%fixed-output_files", YACC_YACC},
393       {"while", C_WHILE},
394       {"%debug", YACC_DEBUG},
395       {""}, {""},
396       {"__alignof", C__ALIGNOF},
397       {""},
398       {"__alignof__", C__ALIGNOF},
399       {""}, {""}, {""}, {""}, {""}, {""}, {""},
400       {"%fixed_output-files", YACC_YACC},
401       {""},
402       {"%destructor", YACC_DESTRUCTOR},
403       {"__volatile__", C_VOLATILE},
404       {""}, {""}, {""}, {""}, {""},
405       {"%default_prec", YACC_DEFAULT_PREC},
406       {"%fixed-output-files", YACC_YACC},
407       {"%expect_rr", YACC_EXPECT_RR},
408       {"%merge", YACC_MERGE},
409       {""}, {""}, {""}, {""},
410       {"__attribute", C___ATTRIBUTE__},
411       {""},
412       {"%default-prec", YACC_DEFAULT_PREC},
413       {""},
414       {"%expect-rr", YACC_EXPECT_RR},
415       {""},
416       {"#pragma", SHARP_PRAGMA},
417       {""}, {""},
418       {"%locations", YACC_LOCATIONS},
419       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
420       {"%error_verbose", YACC_ERROR_VERBOSE},
421       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
422       {"%error-verbose", YACC_ERROR_VERBOSE},
423       {""}, {""}, {""},
424       {"__attribute__", C___ATTRIBUTE__},
425       {"__complex", C__COMPLEX},
426       {""},
427       {"__complex__", C__COMPLEX},
428       {""}, {""}, {""}, {""}, {""}, {""},
429       {"_Complex", C__COMPLEX},
430       {""}, {""}, {""},
431       {"%parse-param", YACC_PARSE_PARAM},
432       {""}, {""}, {""}, {""},
433       {"%binary", YACC_NONASSOC},
434       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
435       {""}, {""}, {""}, {""},
436       {"%glr-parser", YACC_GLR_PARSER},
437       {""}, {""}, {""},
438       {"%initial-action", YACC_INITIAL_ACTION},
439       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
440       {"%lex-param", YACC_LEX_PARAM},
441       {""}, {""},
442       {"_Thread_local", C__THREAD_LOCAL},
443       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
444       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
445       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
446       {""}, {""}, {""}, {""}, {""}, {""},
447       {"%pure_parser", YACC_PURE_PARSER},
448       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
449       {"%pure-parser", YACC_PURE_PARSER},
450       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
451       {""}, {""}, {""}, {""}, {""},
452       {"%name_prefix", YACC_NAME_PREFIX},
453       {""}, {""}, {""}, {""},
454       {"%file-prefix", YACC_FILE_PREFIX},
455       {""}, {""}, {""}, {""},
456       {"%name-prefix", YACC_NAME_PREFIX}
457     };
458 
459   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
460     {
461       register unsigned int key = c_hash (str, len);
462 
463       if (key <= MAX_HASH_VALUE)
464         {
465           register const char *s = wordlist[key].name;
466 
467           if (*str == *s && !strcmp (str + 1, s + 1))
468             return &wordlist[key];
469         }
470     }
471   return 0;
472 }
473 
474 int
c_reserved_word(const char * str,int len)475 c_reserved_word(const char *str, int len)
476 {
477 	struct keyword *keyword;
478 
479 	keyword = c_lookup(str, len);
480 	return (keyword && IS_RESERVED_WORD(keyword->token)) ? keyword->token : 0;
481 }
482 int
c_reserved_sharp(const char * str,int len)483 c_reserved_sharp(const char *str, int len)
484 {
485 	struct keyword *keyword;
486 
487 	/* Delete blanks. Ex. ' # define ' => '#define' */
488 	str = strtrim(str, TRIM_ALL, &len);
489 
490 	keyword = c_lookup(str, len);
491 	return (keyword && IS_RESERVED_SHARP(keyword->token)) ? keyword->token : 0;
492 }
493 int
c_reserved_yacc(const char * str,int len)494 c_reserved_yacc(const char *str, int len)
495 {
496 	struct keyword *keyword;
497 
498 	keyword = c_lookup(str, len);
499 	return (keyword && IS_RESERVED_YACC(keyword->token)) ? keyword->token : 0;
500 }
501