Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

lex.c
Go to the documentation of this file.
1 /* C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf -C -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-gnu-gperf@gnu.org>."
29 #endif
30
31 #line 1 "defs/keywords"
32
33 struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
34 const struct kwtable *rb_reserved_word(const char *, unsigned int);
35 #ifndef RIPPER
36 static const struct kwtable *reserved_word(const char *, unsigned int);
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 (str, len)
57 register const char *str;
58 register unsigned int len;
59 {
60 static const unsigned char asso_values[] =
61 {
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, 51, 51, 51, 51, 51, 51, 51,
68 51, 51, 51, 26, 51, 51, 14, 51, 16, 8,
69 11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
70 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
71 51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
72 4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
73 5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
74 24, 16, 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, 51, 51, 51, 51,
87 51, 51, 51, 51, 51, 51
88 };
89 register int hval = len;
90
91 switch (hval)
92 {
93 default:
94 hval += asso_values[(unsigned char)str[2]];
95 /*FALLTHROUGH*/
96 case 2:
97 case 1:
98 hval += asso_values[(unsigned char)str[0]];
99 break;
100 }
101 return hval + asso_values[(unsigned char)str[len - 1]];
102 }
103
104 #ifdef __GNUC__
105 __inline
106 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
107 __attribute__ ((__gnu_inline__))
108 #endif
109 #endif
110 const struct kwtable *
111 rb_reserved_word (str, len)
112 register const char *str;
113 register unsigned int len;
114 {
115 static const struct kwtable wordlist[] =
116 {
117 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
118 #line 19 "defs/keywords"
119 {"break", {keyword_break, keyword_break}, EXPR_MID},
120 #line 25 "defs/keywords"
121 {"else", {keyword_else, keyword_else}, EXPR_BEG},
122 #line 35 "defs/keywords"
123 {"nil", {keyword_nil, keyword_nil}, EXPR_END},
124 #line 28 "defs/keywords"
125 {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
126 #line 27 "defs/keywords"
127 {"end", {keyword_end, keyword_end}, EXPR_END},
128 #line 44 "defs/keywords"
129 {"then", {keyword_then, keyword_then}, EXPR_BEG},
130 #line 36 "defs/keywords"
131 {"not", {keyword_not, keyword_not}, EXPR_ARG},
132 #line 29 "defs/keywords"
133 {"false", {keyword_false, keyword_false}, EXPR_END},
134 #line 42 "defs/keywords"
135 {"self", {keyword_self, keyword_self}, EXPR_END},
136 #line 26 "defs/keywords"
137 {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
138 #line 39 "defs/keywords"
139 {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
140 #line 45 "defs/keywords"
141 {"true", {keyword_true, keyword_true}, EXPR_END},
142 #line 48 "defs/keywords"
143 {"until", {keyword_until, modifier_until}, EXPR_VALUE},
144 #line 47 "defs/keywords"
145 {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
146 #line 41 "defs/keywords"
147 {"return", {keyword_return, keyword_return}, EXPR_MID},
148 #line 22 "defs/keywords"
149 {"def", {keyword_def, keyword_def}, EXPR_FNAME},
150 #line 17 "defs/keywords"
151 {"and", {keyword_and, keyword_and}, EXPR_VALUE},
152 #line 24 "defs/keywords"
153 {"do", {keyword_do, keyword_do}, EXPR_BEG},
154 #line 51 "defs/keywords"
155 {"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
156 #line 30 "defs/keywords"
157 {"for", {keyword_for, keyword_for}, EXPR_VALUE},
158 #line 46 "defs/keywords"
159 {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
160 #line 37 "defs/keywords"
161 {"or", {keyword_or, keyword_or}, EXPR_VALUE},
162 #line 32 "defs/keywords"
163 {"in", {keyword_in, keyword_in}, EXPR_VALUE},
164 #line 49 "defs/keywords"
165 {"when", {keyword_when, keyword_when}, EXPR_VALUE},
166 #line 40 "defs/keywords"
167 {"retry", {keyword_retry, keyword_retry}, EXPR_END},
168 #line 31 "defs/keywords"
169 {"if", {keyword_if, modifier_if}, EXPR_VALUE},
170 #line 20 "defs/keywords"
171 {"case", {keyword_case, keyword_case}, EXPR_VALUE},
172 #line 38 "defs/keywords"
173 {"redo", {keyword_redo, keyword_redo}, EXPR_END},
174 #line 34 "defs/keywords"
175 {"next", {keyword_next, keyword_next}, EXPR_MID},
176 #line 43 "defs/keywords"
177 {"super", {keyword_super, keyword_super}, EXPR_ARG},
178 #line 33 "defs/keywords"
179 {"module", {keyword_module, keyword_module}, EXPR_VALUE},
180 #line 18 "defs/keywords"
181 {"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
182 #line 12 "defs/keywords"
183 {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
184 #line 13 "defs/keywords"
185 {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
186 #line 11 "defs/keywords"
187 {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
188 #line 15 "defs/keywords"
189 {"END", {keyword_END, keyword_END}, EXPR_END},
190 #line 16 "defs/keywords"
191 {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
192 #line 14 "defs/keywords"
193 {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
194 #line 23 "defs/keywords"
195 {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
196 #line 21 "defs/keywords"
197 {"class", {keyword_class, keyword_class}, EXPR_CLASS},
198 {""}, {""},
199 #line 50 "defs/keywords"
200 {"while", {keyword_while, modifier_while}, EXPR_VALUE}
201 };
202
203 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
204 {
205 register int key = hash (str, len);
206
207 if (key <= MAX_HASH_VALUE && key >= 0)
208 {
209 register const char *s = wordlist[key].name;
210
211 if (*str == *s && !strcmp (str + 1, s + 1))
212 return &wordlist[key];
213 }
214 }
215 return 0;
216 }
217 #line 52 "defs/keywords"
218
219 #endif
keyword_not
Definition: ripper.y:78
kwtable::state
enum lex_state_e state
Definition: lex.c:33
kwtable
Definition: lex.c:33
keyword_class
Definition: ripper.y:42
kwtable::name
const char * name
Definition: lex.c:33
keyword_unless
Definition: ripper.y:51
keyword__FILE__
Definition: ripper.y:89
keyword_break
Definition: ripper.y:60
keyword_true
Definition: ripper.y:74
keyword_for
Definition: ripper.y:59
keyword_super
Definition: ripper.y:71
modifier_rescue
Definition: ripper.y:83
keyword_rescue
Definition: ripper.y:47
asso_values
return hval asso_values[(unsigned char) str[len-1]]
Definition: lex.c:101
keyword_yield
Definition: ripper.y:70
modifier_if
Definition: ripper.y:79
keyword_and
Definition: ripper.y:76
keyword_while
Definition: ripper.y:57
hash
VALUE hash
Definition: tkutil.c:267
keyword_self
Definition: ripper.y:72
modifier_until
Definition: ripper.y:82
keyword_def
Definition: ripper.y:44
keyword__LINE__
Definition: ripper.y:88
keyword_in
Definition: ripper.y:64
keyword_end
Definition: ripper.y:49
keyword_false
Definition: ripper.y:75
keyword_nil
Definition: ripper.y:73
keyword_case
Definition: ripper.y:55
key
static int VALUE key
Definition: tkutil.c:265
hval
register int hval
Definition: lex.c:89
str
static unsigned int register const char * str
Definition: lex.c:57
keyword_undef
Definition: ripper.y:45
const
#define const
Definition: strftime.c:102
s
register char * s
Definition: os2.c:56
keyword_do
Definition: ripper.y:65
keyword_redo
Definition: ripper.y:62
rb_reserved_word
#define rb_reserved_word(str, len)
Definition: lex.c:37
modifier_unless
Definition: ripper.y:80
keyword_END
Definition: ripper.y:87
keyword_ensure
Definition: ripper.y:48
MIN_WORD_LENGTH
#define MIN_WORD_LENGTH
Definition: lex.c:42
keyword_then
Definition: ripper.y:52
keyword_next
Definition: ripper.y:61
modifier_while
Definition: ripper.y:81
keyword_begin
Definition: ripper.y:46
keyword_when
Definition: ripper.y:56
keyword_BEGIN
keyword_BEGIN
Definition: ripper.y:1028
lex_state_e
lex_state_e
Definition: ripper.c:140
keyword_defined
Definition: ripper.y:85
keyword_module
Definition: ripper.y:43
keyword_else
Definition: ripper.y:54
keyword_return
Definition: ripper.y:69
keyword_retry
Definition: ripper.y:63
keyword__ENCODING__
Definition: ripper.y:90
keyword_if
Definition: ripper.y:50
reserved_word
static struct kwtable * reserved_word(const char *, unsigned int)
keyword_until
Definition: ripper.y:58
keyword_alias
Definition: ripper.y:84
keyword_or
Definition: ripper.y:77
keyword_elsif
Definition: ripper.y:53
len
size_t len
Definition: tcltklib.c:3568