source: trunk/third/gcc/c-gperf.h @ 8834

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