Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

lex.c
Go to the documentation of this file.
1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: gperf -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 #define gperf_offsetof(s, n) (short)offsetof(struct s##_t, s##_str##n)
32 #line 1 "defs/keywords"
33
34 struct kwtable {short name, id[2], state;};
35 const struct kwtable *rb_reserved_word(const char *, unsigned int);
36 #ifndef RIPPER
37 static const struct kwtable *reserved_word(/*const char *, unsigned int*/);
38 #define rb_reserved_word(str, len) reserved_word(str, len)
39 #line 9 "defs/keywords"
40 struct kwtable;
41
42 #define TOTAL_KEYWORDS 41
43 #define MIN_WORD_LENGTH 2
44 #define MAX_WORD_LENGTH 12
45 #define MIN_HASH_VALUE 8
46 #define MAX_HASH_VALUE 50
47 /* maximum key range = 43, duplicates = 0 */
48
49 #ifdef __GNUC__
50 __inline
51 #else
52 #ifdef __cplusplus
53 inline
54 #endif
55 #endif
56 static unsigned int
57 hash (register const char *str, register size_t len)
58 {
59 static const unsigned char asso_values[] =
60 {
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, 51, 51, 51, 51, 51, 51, 51,
67 51, 51, 51, 26, 51, 51, 14, 51, 16, 8,
68 11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
69 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
70 51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
71 4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
72 5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
73 24, 16, 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, 51, 51, 51, 51,
86 51, 51, 51, 51, 51, 51
87 };
88 register unsigned int hval = (unsigned int)len;
89
90 switch (hval)
91 {
92 default:
93 hval += asso_values[(unsigned char)str[2]];
94 /*FALLTHROUGH*/
95 case 2:
96 case 1:
97 hval += asso_values[(unsigned char)str[0]];
98 break;
99 }
100 return (unsigned int)hval + asso_values[(unsigned char)str[len - 1]];
101 }
102
103 struct stringpool_t
104 {
105 char stringpool_str8[sizeof("break")];
106 char stringpool_str9[sizeof("else")];
107 char stringpool_str10[sizeof("nil")];
108 char stringpool_str11[sizeof("ensure")];
109 char stringpool_str12[sizeof("end")];
110 char stringpool_str13[sizeof("then")];
111 char stringpool_str14[sizeof("not")];
112 char stringpool_str15[sizeof("false")];
113 char stringpool_str16[sizeof("self")];
114 char stringpool_str17[sizeof("elsif")];
115 char stringpool_str18[sizeof("rescue")];
116 char stringpool_str19[sizeof("true")];
117 char stringpool_str20[sizeof("until")];
118 char stringpool_str21[sizeof("unless")];
119 char stringpool_str22[sizeof("return")];
120 char stringpool_str23[sizeof("def")];
121 char stringpool_str24[sizeof("and")];
122 char stringpool_str25[sizeof("do")];
123 char stringpool_str26[sizeof("yield")];
124 char stringpool_str27[sizeof("for")];
125 char stringpool_str28[sizeof("undef")];
126 char stringpool_str29[sizeof("or")];
127 char stringpool_str30[sizeof("in")];
128 char stringpool_str31[sizeof("when")];
129 char stringpool_str32[sizeof("retry")];
130 char stringpool_str33[sizeof("if")];
131 char stringpool_str34[sizeof("case")];
132 char stringpool_str35[sizeof("redo")];
133 char stringpool_str36[sizeof("next")];
134 char stringpool_str37[sizeof("super")];
135 char stringpool_str38[sizeof("module")];
136 char stringpool_str39[sizeof("begin")];
137 char stringpool_str40[sizeof("__LINE__")];
138 char stringpool_str41[sizeof("__FILE__")];
139 char stringpool_str42[sizeof("__ENCODING__")];
140 char stringpool_str43[sizeof("END")];
141 char stringpool_str44[sizeof("alias")];
142 char stringpool_str45[sizeof("BEGIN")];
143 char stringpool_str46[sizeof("defined?")];
144 char stringpool_str47[sizeof("class")];
145 char stringpool_str50[sizeof("while")];
146 };
147 static const struct stringpool_t stringpool_contents =
148 {
149 "break",
150 "else",
151 "nil",
152 "ensure",
153 "end",
154 "then",
155 "not",
156 "false",
157 "self",
158 "elsif",
159 "rescue",
160 "true",
161 "until",
162 "unless",
163 "return",
164 "def",
165 "and",
166 "do",
167 "yield",
168 "for",
169 "undef",
170 "or",
171 "in",
172 "when",
173 "retry",
174 "if",
175 "case",
176 "redo",
177 "next",
178 "super",
179 "module",
180 "begin",
181 "__LINE__",
182 "__FILE__",
183 "__ENCODING__",
184 "END",
185 "alias",
186 "BEGIN",
187 "defined?",
188 "class",
189 "while"
190 };
191 #define stringpool ((const char *) &stringpool_contents)
192 const struct kwtable *
193 rb_reserved_word (register const char *str, register size_t len)
194 {
195 static const struct kwtable wordlist[] =
196 {
197 {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
198 #line 19 "defs/keywords"
199 {gperf_offsetof(stringpool, 8), {keyword_break, keyword_break}, EXPR_MID},
200 #line 25 "defs/keywords"
201 {gperf_offsetof(stringpool, 9), {keyword_else, keyword_else}, EXPR_BEG},
202 #line 35 "defs/keywords"
203 {gperf_offsetof(stringpool, 10), {keyword_nil, keyword_nil}, EXPR_END},
204 #line 28 "defs/keywords"
205 {gperf_offsetof(stringpool, 11), {keyword_ensure, keyword_ensure}, EXPR_BEG},
206 #line 27 "defs/keywords"
207 {gperf_offsetof(stringpool, 12), {keyword_end, keyword_end}, EXPR_END},
208 #line 44 "defs/keywords"
209 {gperf_offsetof(stringpool, 13), {keyword_then, keyword_then}, EXPR_BEG},
210 #line 36 "defs/keywords"
211 {gperf_offsetof(stringpool, 14), {keyword_not, keyword_not}, EXPR_ARG},
212 #line 29 "defs/keywords"
213 {gperf_offsetof(stringpool, 15), {keyword_false, keyword_false}, EXPR_END},
214 #line 42 "defs/keywords"
215 {gperf_offsetof(stringpool, 16), {keyword_self, keyword_self}, EXPR_END},
216 #line 26 "defs/keywords"
217 {gperf_offsetof(stringpool, 17), {keyword_elsif, keyword_elsif}, EXPR_VALUE},
218 #line 39 "defs/keywords"
219 {gperf_offsetof(stringpool, 18), {keyword_rescue, modifier_rescue}, EXPR_MID},
220 #line 45 "defs/keywords"
221 {gperf_offsetof(stringpool, 19), {keyword_true, keyword_true}, EXPR_END},
222 #line 48 "defs/keywords"
223 {gperf_offsetof(stringpool, 20), {keyword_until, modifier_until}, EXPR_VALUE},
224 #line 47 "defs/keywords"
225 {gperf_offsetof(stringpool, 21), {keyword_unless, modifier_unless}, EXPR_VALUE},
226 #line 41 "defs/keywords"
227 {gperf_offsetof(stringpool, 22), {keyword_return, keyword_return}, EXPR_MID},
228 #line 22 "defs/keywords"
229 {gperf_offsetof(stringpool, 23), {keyword_def, keyword_def}, EXPR_FNAME},
230 #line 17 "defs/keywords"
231 {gperf_offsetof(stringpool, 24), {keyword_and, keyword_and}, EXPR_VALUE},
232 #line 24 "defs/keywords"
233 {gperf_offsetof(stringpool, 25), {keyword_do, keyword_do}, EXPR_BEG},
234 #line 51 "defs/keywords"
235 {gperf_offsetof(stringpool, 26), {keyword_yield, keyword_yield}, EXPR_ARG},
236 #line 30 "defs/keywords"
237 {gperf_offsetof(stringpool, 27), {keyword_for, keyword_for}, EXPR_VALUE},
238 #line 46 "defs/keywords"
239 {gperf_offsetof(stringpool, 28), {keyword_undef, keyword_undef}, EXPR_FNAME|EXPR_FITEM},
240 #line 37 "defs/keywords"
241 {gperf_offsetof(stringpool, 29), {keyword_or, keyword_or}, EXPR_VALUE},
242 #line 32 "defs/keywords"
243 {gperf_offsetof(stringpool, 30), {keyword_in, keyword_in}, EXPR_VALUE},
244 #line 49 "defs/keywords"
245 {gperf_offsetof(stringpool, 31), {keyword_when, keyword_when}, EXPR_VALUE},
246 #line 40 "defs/keywords"
247 {gperf_offsetof(stringpool, 32), {keyword_retry, keyword_retry}, EXPR_END},
248 #line 31 "defs/keywords"
249 {gperf_offsetof(stringpool, 33), {keyword_if, modifier_if}, EXPR_VALUE},
250 #line 20 "defs/keywords"
251 {gperf_offsetof(stringpool, 34), {keyword_case, keyword_case}, EXPR_VALUE},
252 #line 38 "defs/keywords"
253 {gperf_offsetof(stringpool, 35), {keyword_redo, keyword_redo}, EXPR_END},
254 #line 34 "defs/keywords"
255 {gperf_offsetof(stringpool, 36), {keyword_next, keyword_next}, EXPR_MID},
256 #line 43 "defs/keywords"
257 {gperf_offsetof(stringpool, 37), {keyword_super, keyword_super}, EXPR_ARG},
258 #line 33 "defs/keywords"
259 {gperf_offsetof(stringpool, 38), {keyword_module, keyword_module}, EXPR_VALUE},
260 #line 18 "defs/keywords"
261 {gperf_offsetof(stringpool, 39), {keyword_begin, keyword_begin}, EXPR_BEG},
262 #line 12 "defs/keywords"
263 {gperf_offsetof(stringpool, 40), {keyword__LINE__, keyword__LINE__}, EXPR_END},
264 #line 13 "defs/keywords"
265 {gperf_offsetof(stringpool, 41), {keyword__FILE__, keyword__FILE__}, EXPR_END},
266 #line 11 "defs/keywords"
267 {gperf_offsetof(stringpool, 42), {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
268 #line 15 "defs/keywords"
269 {gperf_offsetof(stringpool, 43), {keyword_END, keyword_END}, EXPR_END},
270 #line 16 "defs/keywords"
271 {gperf_offsetof(stringpool, 44), {keyword_alias, keyword_alias}, EXPR_FNAME|EXPR_FITEM},
272 #line 14 "defs/keywords"
273 {gperf_offsetof(stringpool, 45), {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
274 #line 23 "defs/keywords"
275 {gperf_offsetof(stringpool, 46), {keyword_defined, keyword_defined}, EXPR_ARG},
276 #line 21 "defs/keywords"
277 {gperf_offsetof(stringpool, 47), {keyword_class, keyword_class}, EXPR_CLASS},
278 {-1}, {-1},
279 #line 50 "defs/keywords"
280 {gperf_offsetof(stringpool, 50), {keyword_while, modifier_while}, EXPR_VALUE}
281 };
282
283 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
284 {
285 register unsigned int key = hash (str, len);
286
287 if (key <= MAX_HASH_VALUE)
288 {
289 register int o = wordlist[key].name;
290 if (o >= 0)
291 {
292 register const char *s = o + stringpool;
293
294 if (*str == *s && !strcmp (str + 1, s + 1))
295 return &wordlist[key];
296 }
297 }
298 }
299 return 0;
300 }
301 #line 52 "defs/keywords"
302
303 #endif
kwtable
Definition: lex.c:34
kwtable::state
short state
Definition: lex.c:34
keyword_defined
@ keyword_defined
Definition: parse.h:92
stringpool_t::stringpool_str15
char stringpool_str15[sizeof("pet")]
Definition: zonetab.h:177
keyword_class
@ keyword_class
Definition: parse.h:49
keyword_self
@ keyword_self
Definition: parse.h:79
keyword_next
@ keyword_next
Definition: parse.h:68
keyword_if
@ keyword_if
Definition: parse.h:57
gperf_offsetof
#define gperf_offsetof(s, n)
Definition: lex.c:31
keyword_module
@ keyword_module
Definition: parse.h:50
keyword_false
@ keyword_false
Definition: parse.h:82
keyword_not
@ keyword_not
Definition: parse.h:85
stringpool_t::stringpool_str47
char stringpool_str47[sizeof("cst")]
Definition: zonetab.h:206
keyword_alias
@ keyword_alias
Definition: parse.h:91
int
__inline__ int
Definition: rb_mjit_min_header-2.7.0.h:2839
modifier_rescue
@ modifier_rescue
Definition: parse.h:90
keyword_begin
@ keyword_begin
Definition: parse.h:53
stringpool_t::stringpool_str31
char stringpool_str31[sizeof("c")]
Definition: zonetab.h:192
stringpool_t::stringpool_str21
char stringpool_str21[sizeof("eest")]
Definition: zonetab.h:183
stringpool_t::stringpool_str12
char stringpool_str12[sizeof("end")]
Definition: lex.c:109
stringpool_t::stringpool_str30
char stringpool_str30[sizeof("est")]
Definition: zonetab.h:191
stringpool_t::stringpool_str34
char stringpool_str34[sizeof("case")]
Definition: lex.c:131
stringpool_t::stringpool_str38
char stringpool_str38[sizeof("cest")]
Definition: zonetab.h:198
modifier_while
@ modifier_while
Definition: parse.h:88
stringpool_t::stringpool_str45
char stringpool_str45[sizeof("msk")]
Definition: zonetab.h:204
stringpool_t::stringpool_str19
char stringpool_str19[sizeof("eet")]
Definition: zonetab.h:181
keyword_when
@ keyword_when
Definition: parse.h:63
stringpool_t::stringpool_str23
char stringpool_str23[sizeof("def")]
Definition: lex.c:120
stringpool_t::stringpool_str37
char stringpool_str37[sizeof("d")]
Definition: zonetab.h:197
stringpool_t::stringpool_str24
char stringpool_str24[sizeof("east")]
Definition: zonetab.h:185
stringpool_t::stringpool_str35
char stringpool_str35[sizeof("mest")]
Definition: zonetab.h:195
keyword_def
@ keyword_def
Definition: parse.h:51
keyword_ensure
@ keyword_ensure
Definition: parse.h:55
keyword_rescue
@ keyword_rescue
Definition: parse.h:54
keyword_redo
@ keyword_redo
Definition: parse.h:69
keyword__LINE__
@ keyword__LINE__
Definition: parse.h:95
keyword_unless
@ keyword_unless
Definition: parse.h:58
stringpool_t::stringpool_str46
char stringpool_str46[sizeof("cot")]
Definition: zonetab.h:205
keyword_true
@ keyword_true
Definition: parse.h:81
stringpool_t::stringpool_str26
char stringpool_str26[sizeof("pst")]
Definition: zonetab.h:187
stringpool_t::stringpool_str17
char stringpool_str17[sizeof("pett")]
Definition: zonetab.h:179
stringpool_t::stringpool_str40
char stringpool_str40[sizeof("__LINE__")]
Definition: lex.c:137
stringpool_t::stringpool_str11
char stringpool_str11[sizeof("ensure")]
Definition: lex.c:108
keyword_END
@ keyword_END
Definition: parse.h:94
stringpool_t::stringpool_str43
char stringpool_str43[sizeof("magst")]
Definition: zonetab.h:202
stringpool_t::stringpool_str22
char stringpool_str22[sizeof("eat")]
Definition: zonetab.h:184
stringpool_t::stringpool_str20
char stringpool_str20[sizeof("aest")]
Definition: zonetab.h:182
stringpool_t::stringpool_str50
char stringpool_str50[sizeof("while")]
Definition: lex.c:145
keyword_else
@ keyword_else
Definition: parse.h:61
keyword_retry
@ keyword_retry
Definition: parse.h:70
keyword__FILE__
@ keyword__FILE__
Definition: parse.h:96
stringpool_t::stringpool_str16
char stringpool_str16[sizeof("pmst")]
Definition: zonetab.h:178
keyword_then
@ keyword_then
Definition: parse.h:59
stringpool_t::stringpool_str32
char stringpool_str32[sizeof("mmt")]
Definition: zonetab.h:193
keyword_end
@ keyword_end
Definition: parse.h:56
stringpool_t::stringpool_str10
char stringpool_str10[sizeof("p")]
Definition: zonetab.h:174
modifier_unless
@ modifier_unless
Definition: parse.h:87
keyword_while
@ keyword_while
Definition: parse.h:64
stringpool_t::stringpool_str8
char stringpool_str8[sizeof("omst")]
Definition: zonetab.h:172
key
key
Definition: openssl_missing.h:181
kwtable::name
short name
Definition: lex.c:34
stringpool_t::stringpool_str36
char stringpool_str36[sizeof("cet")]
Definition: zonetab.h:196
keyword_super
@ keyword_super
Definition: parse.h:78
strcmp
int strcmp(const char *, const char *)
keyword_BEGIN
@ keyword_BEGIN
Definition: parse.h:93
stringpool_t::stringpool_str42
char stringpool_str42[sizeof("magt")]
Definition: zonetab.h:201
char
#define char
Definition: rb_mjit_min_header-2.7.0.h:2876
stringpool
#define stringpool
Definition: lex.c:191
keyword_and
@ keyword_and
Definition: parse.h:83
keyword_return
@ keyword_return
Definition: parse.h:76
stringpool_t::stringpool_str39
char stringpool_str39[sizeof("cat")]
Definition: zonetab.h:199
keyword_do
@ keyword_do
Definition: parse.h:72
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
keyword_undef
@ keyword_undef
Definition: parse.h:52
keyword_until
@ keyword_until
Definition: parse.h:65
keyword_for
@ keyword_for
Definition: parse.h:66
MAX_HASH_VALUE
#define MAX_HASH_VALUE
Definition: lex.c:46
keyword_or
@ keyword_or
Definition: parse.h:84
keyword_in
@ keyword_in
Definition: parse.h:71
stringpool_t::stringpool_str29
char stringpool_str29[sizeof("ast")]
Definition: zonetab.h:190
stringpool_t::stringpool_str41
char stringpool_str41[sizeof("cast")]
Definition: zonetab.h:200
stringpool_t::stringpool_str28
char stringpool_str28[sizeof("m")]
Definition: zonetab.h:189
len
uint8_t len
Definition: escape.c:17
stringpool_t::stringpool_str27
char stringpool_str27[sizeof("eastern")]
Definition: zonetab.h:188
modifier_until
@ modifier_until
Definition: parse.h:89
rb_reserved_word
#define rb_reserved_word(str, len)
Definition: lex.c:38
keyword_case
@ keyword_case
Definition: parse.h:62
stringpool_t::stringpool_str9
char stringpool_str9[sizeof("omsst")]
Definition: zonetab.h:173
keyword_break
@ keyword_break
Definition: parse.h:67
stringpool_t::stringpool_str18
char stringpool_str18[sizeof("petst")]
Definition: zonetab.h:180
keyword__ENCODING__
@ keyword__ENCODING__
Definition: parse.h:97
keyword_yield
@ keyword_yield
Definition: parse.h:77
keyword_nil
@ keyword_nil
Definition: parse.h:80
stringpool_t::stringpool_str25
char stringpool_str25[sizeof("easst")]
Definition: zonetab.h:186
EXPR_VALUE
@ EXPR_VALUE
Definition: ripper.c:166
modifier_if
@ modifier_if
Definition: parse.h:86
MIN_WORD_LENGTH
#define MIN_WORD_LENGTH
Definition: lex.c:43
stringpool_t::stringpool_str44
char stringpool_str44[sizeof("mst")]
Definition: zonetab.h:203
stringpool_t::stringpool_str14
char stringpool_str14[sizeof("e")]
Definition: zonetab.h:176
stringpool_t::stringpool_str13
char stringpool_str13[sizeof("a")]
Definition: zonetab.h:175
stringpool_t
Definition: zonetab.h:166
keyword_elsif
@ keyword_elsif
Definition: parse.h:60
stringpool_t::stringpool_str33
char stringpool_str33[sizeof("met")]
Definition: zonetab.h:194