Ruby  3.4.0dev (2024-11-05 revision e440268d51fe02b303e3817a7a733a0dac1c5091)
lex.c
1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: gperf -C -L ANSI-C -P -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */
3 
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5  && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6  && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7  && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8  && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9  && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10  && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11  && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12  && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13  && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14  && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15  && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16  && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17  && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18  && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19  && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20  && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21  && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22  && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23  && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24  && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25  && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26  && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27 /* The character set is not based on ISO-646. */
28 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29 #endif
30 
31 #line 1 "defs/keywords"
32 
33 struct kwtable {short name, id[2], state;};
34 const struct kwtable *rb_reserved_word(const char *, unsigned int);
35 #ifndef RIPPER
36 static const struct kwtable *reserved_word(register const char *str, register size_t len);
37 #define rb_reserved_word(str, len) reserved_word(str, len)
38 #line 9 "defs/keywords"
39 struct kwtable;
40 
41 #define TOTAL_KEYWORDS 41
42 #define MIN_WORD_LENGTH 2
43 #define MAX_WORD_LENGTH 12
44 #define MIN_HASH_VALUE 8
45 #define MAX_HASH_VALUE 50
46 /* maximum key range = 43, duplicates = 0 */
47 
48 #ifdef __GNUC__
49 __inline
50 #else
51 #ifdef __cplusplus
52 inline
53 #endif
54 #endif
55 static unsigned int
56 hash (register const char *str, register size_t len)
57 {
58  static const unsigned char asso_values[] =
59  {
60  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
61  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
62  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
63  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
64  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
65  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
66  51, 51, 51, 26, 51, 51, 14, 51, 16, 8,
67  11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
68  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
69  51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
70  4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
71  5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
72  24, 16, 51, 51, 51, 51, 51, 51, 51, 51,
73  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
74  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
75  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
76  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
77  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
78  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
79  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
80  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
81  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
82  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
83  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
84  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
85  51, 51, 51, 51, 51, 51
86  };
87  register unsigned int hval = (unsigned int)len;
88 
89  switch (hval)
90  {
91  default:
92  hval += asso_values[(unsigned char)str[2]];
93  /*FALLTHROUGH*/
94  case 2:
95  case 1:
96  hval += asso_values[(unsigned char)str[0]];
97  break;
98  }
99  return (unsigned int)hval + asso_values[(unsigned char)str[len - 1]];
100 }
101 
102 struct stringpool_t
103  {
104  char stringpool_str8[sizeof("break")];
105  char stringpool_str9[sizeof("else")];
106  char stringpool_str10[sizeof("nil")];
107  char stringpool_str11[sizeof("ensure")];
108  char stringpool_str12[sizeof("end")];
109  char stringpool_str13[sizeof("then")];
110  char stringpool_str14[sizeof("not")];
111  char stringpool_str15[sizeof("false")];
112  char stringpool_str16[sizeof("self")];
113  char stringpool_str17[sizeof("elsif")];
114  char stringpool_str18[sizeof("rescue")];
115  char stringpool_str19[sizeof("true")];
116  char stringpool_str20[sizeof("until")];
117  char stringpool_str21[sizeof("unless")];
118  char stringpool_str22[sizeof("return")];
119  char stringpool_str23[sizeof("def")];
120  char stringpool_str24[sizeof("and")];
121  char stringpool_str25[sizeof("do")];
122  char stringpool_str26[sizeof("yield")];
123  char stringpool_str27[sizeof("for")];
124  char stringpool_str28[sizeof("undef")];
125  char stringpool_str29[sizeof("or")];
126  char stringpool_str30[sizeof("in")];
127  char stringpool_str31[sizeof("when")];
128  char stringpool_str32[sizeof("retry")];
129  char stringpool_str33[sizeof("if")];
130  char stringpool_str34[sizeof("case")];
131  char stringpool_str35[sizeof("redo")];
132  char stringpool_str36[sizeof("next")];
133  char stringpool_str37[sizeof("super")];
134  char stringpool_str38[sizeof("module")];
135  char stringpool_str39[sizeof("begin")];
136  char stringpool_str40[sizeof("__LINE__")];
137  char stringpool_str41[sizeof("__FILE__")];
138  char stringpool_str42[sizeof("__ENCODING__")];
139  char stringpool_str43[sizeof("END")];
140  char stringpool_str44[sizeof("alias")];
141  char stringpool_str45[sizeof("BEGIN")];
142  char stringpool_str46[sizeof("defined?")];
143  char stringpool_str47[sizeof("class")];
144  char stringpool_str50[sizeof("while")];
145  };
146 static const struct stringpool_t stringpool_contents =
147  {
148  "break",
149  "else",
150  "nil",
151  "ensure",
152  "end",
153  "then",
154  "not",
155  "false",
156  "self",
157  "elsif",
158  "rescue",
159  "true",
160  "until",
161  "unless",
162  "return",
163  "def",
164  "and",
165  "do",
166  "yield",
167  "for",
168  "undef",
169  "or",
170  "in",
171  "when",
172  "retry",
173  "if",
174  "case",
175  "redo",
176  "next",
177  "super",
178  "module",
179  "begin",
180  "__LINE__",
181  "__FILE__",
182  "__ENCODING__",
183  "END",
184  "alias",
185  "BEGIN",
186  "defined?",
187  "class",
188  "while"
189  };
190 #define stringpool ((const char *) &stringpool_contents)
191 const struct kwtable *
192 rb_reserved_word (register const char *str, register size_t len)
193 {
194  static const struct kwtable wordlist[] =
195  {
196  {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
197 #line 19 "defs/keywords"
198  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, {keyword_break, keyword_break}, EXPR_MID},
199 #line 25 "defs/keywords"
200  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, {keyword_else, keyword_else}, EXPR_BEG},
201 #line 35 "defs/keywords"
202  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, {keyword_nil, keyword_nil}, EXPR_END},
203 #line 28 "defs/keywords"
204  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, {keyword_ensure, keyword_ensure}, EXPR_BEG},
205 #line 27 "defs/keywords"
206  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, {keyword_end, keyword_end}, EXPR_END},
207 #line 44 "defs/keywords"
208  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, {keyword_then, keyword_then}, EXPR_BEG},
209 #line 36 "defs/keywords"
210  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, {keyword_not, keyword_not}, EXPR_ARG},
211 #line 29 "defs/keywords"
212  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, {keyword_false, keyword_false}, EXPR_END},
213 #line 42 "defs/keywords"
214  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, {keyword_self, keyword_self}, EXPR_END},
215 #line 26 "defs/keywords"
216  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, {keyword_elsif, keyword_elsif}, EXPR_VALUE},
217 #line 39 "defs/keywords"
218  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, {keyword_rescue, modifier_rescue}, EXPR_MID},
219 #line 45 "defs/keywords"
220  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, {keyword_true, keyword_true}, EXPR_END},
221 #line 48 "defs/keywords"
222  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, {keyword_until, modifier_until}, EXPR_VALUE},
223 #line 47 "defs/keywords"
224  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, {keyword_unless, modifier_unless}, EXPR_VALUE},
225 #line 41 "defs/keywords"
226  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, {keyword_return, keyword_return}, EXPR_MID},
227 #line 22 "defs/keywords"
228  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, {keyword_def, keyword_def}, EXPR_FNAME},
229 #line 17 "defs/keywords"
230  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, {keyword_and, keyword_and}, EXPR_VALUE},
231 #line 24 "defs/keywords"
232  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, {keyword_do, keyword_do}, EXPR_BEG},
233 #line 51 "defs/keywords"
234  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, {keyword_yield, keyword_yield}, EXPR_ARG},
235 #line 30 "defs/keywords"
236  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, {keyword_for, keyword_for}, EXPR_VALUE},
237 #line 46 "defs/keywords"
238  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, {keyword_undef, keyword_undef}, EXPR_FNAME|EXPR_FITEM},
239 #line 37 "defs/keywords"
240  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, {keyword_or, keyword_or}, EXPR_VALUE},
241 #line 32 "defs/keywords"
242  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, {keyword_in, keyword_in}, EXPR_VALUE},
243 #line 49 "defs/keywords"
244  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, {keyword_when, keyword_when}, EXPR_VALUE},
245 #line 40 "defs/keywords"
246  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, {keyword_retry, keyword_retry}, EXPR_END},
247 #line 31 "defs/keywords"
248  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, {keyword_if, modifier_if}, EXPR_VALUE},
249 #line 20 "defs/keywords"
250  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, {keyword_case, keyword_case}, EXPR_VALUE},
251 #line 38 "defs/keywords"
252  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, {keyword_redo, keyword_redo}, EXPR_END},
253 #line 34 "defs/keywords"
254  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, {keyword_next, keyword_next}, EXPR_MID},
255 #line 43 "defs/keywords"
256  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, {keyword_super, keyword_super}, EXPR_ARG},
257 #line 33 "defs/keywords"
258  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, {keyword_module, keyword_module}, EXPR_VALUE},
259 #line 18 "defs/keywords"
260  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, {keyword_begin, keyword_begin}, EXPR_BEG},
261 #line 12 "defs/keywords"
262  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, {keyword__LINE__, keyword__LINE__}, EXPR_END},
263 #line 13 "defs/keywords"
264  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, {keyword__FILE__, keyword__FILE__}, EXPR_END},
265 #line 11 "defs/keywords"
266  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
267 #line 15 "defs/keywords"
268  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, {keyword_END, keyword_END}, EXPR_END},
269 #line 16 "defs/keywords"
270  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, {keyword_alias, keyword_alias}, EXPR_FNAME|EXPR_FITEM},
271 #line 14 "defs/keywords"
272  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
273 #line 23 "defs/keywords"
274  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, {keyword_defined, keyword_defined}, EXPR_ARG},
275 #line 21 "defs/keywords"
276  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, {keyword_class, keyword_class}, EXPR_CLASS},
277  {-1}, {-1},
278 #line 50 "defs/keywords"
279  {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str50, {keyword_while, modifier_while}, EXPR_VALUE}
280  };
281 
282  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
283  {
284  register unsigned int key = hash (str, len);
285 
286  if (key <= MAX_HASH_VALUE)
287  {
288  register int o = wordlist[key].name;
289  if (o >= 0)
290  {
291  register const char *s = o + stringpool;
292 
293  if (*str == *s && !strcmp (str + 1, s + 1))
294  return &wordlist[key];
295  }
296  }
297  }
298  return 0;
299 }
300 #line 52 "defs/keywords"
301 
302 #endif