Ruby 3.5.0dev (2025-01-10 revision 5fab31b15e32622c4b71d1d347a41937e9f9c212)
id.h
1/* DO NOT EDIT THIS FILE DIRECTLY */
2/**********************************************************************
3
4 id.h -
5
6 $Author$
7 created at: Sun Oct 19 21:12:51 2008
8
9 Copyright (C) 2007 Koichi Sasada
10
11**********************************************************************/
12
13#ifndef RUBY_ID_H
14#define RUBY_ID_H
15
16enum ruby_id_types {
17 RUBY_ID_STATIC_SYM = 0x01,
18 RUBY_ID_LOCAL = 0x00,
19 RUBY_ID_INSTANCE = (0x01<<1),
20 RUBY_ID_GLOBAL = (0x03<<1),
21 RUBY_ID_ATTRSET = (0x04<<1),
22 RUBY_ID_CONST = (0x05<<1),
23 RUBY_ID_CLASS = (0x06<<1),
24 RUBY_ID_JUNK = (0x07<<1),
25 RUBY_ID_INTERNAL = RUBY_ID_JUNK,
26 RUBY_ID_SCOPE_SHIFT = 4,
27 RUBY_ID_SCOPE_MASK = (~(~0U<<(RUBY_ID_SCOPE_SHIFT-1))<<1)
28};
29
30#define ID_STATIC_SYM RUBY_ID_STATIC_SYM
31#define ID_SCOPE_SHIFT RUBY_ID_SCOPE_SHIFT
32#define ID_SCOPE_MASK RUBY_ID_SCOPE_MASK
33#define ID_LOCAL RUBY_ID_LOCAL
34#define ID_INSTANCE RUBY_ID_INSTANCE
35#define ID_GLOBAL RUBY_ID_GLOBAL
36#define ID_ATTRSET RUBY_ID_ATTRSET
37#define ID_CONST RUBY_ID_CONST
38#define ID_CLASS RUBY_ID_CLASS
39#define ID_JUNK RUBY_ID_JUNK
40#define ID_INTERNAL RUBY_ID_INTERNAL
41
42#define symIFUNC ID2SYM(idIFUNC)
43#define symCFUNC ID2SYM(idCFUNC)
44
45#define RUBY_TOKEN_DOT2 128
46#define RUBY_TOKEN_DOT3 129
47#define RUBY_TOKEN_BDOT2 130
48#define RUBY_TOKEN_BDOT3 131
49#define RUBY_TOKEN_UPLUS 132
50#define RUBY_TOKEN_UMINUS 133
51#define RUBY_TOKEN_POW 134
52#define RUBY_TOKEN_CMP 135
53#define RUBY_TOKEN_LSHFT 136
54#define RUBY_TOKEN_RSHFT 137
55#define RUBY_TOKEN_LEQ 138
56#define RUBY_TOKEN_GEQ 139
57#define RUBY_TOKEN_EQ 140
58#define RUBY_TOKEN_EQQ 141
59#define RUBY_TOKEN_NEQ 142
60#define RUBY_TOKEN_MATCH 143
61#define RUBY_TOKEN_NMATCH 144
62#define RUBY_TOKEN_AREF 145
63#define RUBY_TOKEN_ASET 146
64#define RUBY_TOKEN_COLON2 147
65#define RUBY_TOKEN_ANDOP 148
66#define RUBY_TOKEN_OROP 149
67#define RUBY_TOKEN_ANDDOT 150
68#define RUBY_TOKEN(t) RUBY_TOKEN_##t
69
70#define RUBY_TOKEN2ID_TYPE(tok, type) ((tok<<RUBY_ID_SCOPE_SHIFT)|type|RUBY_ID_STATIC_SYM)
71#define TOKEN2LOCALID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_LOCAL)
72#define TOKEN2INSTANCEID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_INSTANCE)
73#define TOKEN2GLOBALID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_GLOBAL)
74#define TOKEN2CONSTID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_CONST)
75#define TOKEN2CLASSID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_CLASS)
76#define TOKEN2ATTRSETID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_ATTRSET)
77
78enum ruby_method_ids {
79 idDot2 = RUBY_TOKEN(DOT2),
80 idDot3 = RUBY_TOKEN(DOT3),
81 idUPlus = RUBY_TOKEN(UPLUS),
82 idUMinus = RUBY_TOKEN(UMINUS),
83 idPow = RUBY_TOKEN(POW),
84 idCmp = RUBY_TOKEN(CMP),
85 idPLUS = '+',
86 idMINUS = '-',
87 idMULT = '*',
88 idDIV = '/',
89 idMOD = '%',
90 idLTLT = RUBY_TOKEN(LSHFT),
91 idGTGT = RUBY_TOKEN(RSHFT),
92 idLT = '<',
93 idLE = RUBY_TOKEN(LEQ),
94 idGT = '>',
95 idGE = RUBY_TOKEN(GEQ),
96 idEq = RUBY_TOKEN(EQ),
97 idEqq = RUBY_TOKEN(EQQ),
98 idNeq = RUBY_TOKEN(NEQ),
99 idNot = '!',
100 idAnd = '&',
101 idOr = '|',
102 idBackquote = '`',
103 idEqTilde = RUBY_TOKEN(MATCH),
104 idNeqTilde = RUBY_TOKEN(NMATCH),
105 idAREF = RUBY_TOKEN(AREF),
106 idASET = RUBY_TOKEN(ASET),
107 idCOLON2 = RUBY_TOKEN(COLON2),
108 idANDOP = RUBY_TOKEN(ANDOP),
109 idOROP = RUBY_TOKEN(OROP),
110 idANDDOT = RUBY_TOKEN(ANDDOT),
111 tPRESERVED_ID_BEGIN = 150,
112 idNilP,
113 idIncludeP,
114 idNULL,
115 idEmptyP,
116 idEqlP,
117 idRespond_to,
118 idRespond_to_missing,
119 idIFUNC,
120 idCFUNC,
121 id_core_set_method_alias,
122 id_core_set_variable_alias,
123 id_core_undef_method,
124 id_core_define_method,
125 id_core_define_singleton_method,
126 id_core_set_postexe,
127 id_core_hash_merge_ptr,
128 id_core_hash_merge_kwd,
129 id_core_raise,
130 id_core_sprintf,
131 id_debug_created_info,
132 tPRESERVED_ID_END,
133
134 /* LOCAL tokens {{{ */
135 tTOKEN_LOCAL_BEGIN = tPRESERVED_ID_END-1,
136 tMax,
137 tMin,
138 tHash,
139 tFreeze,
140 tInspect,
141 tIntern,
142 tObject_id,
143 t__id__,
144 tConst_added,
145 tConst_missing,
146 tMethodMissing,
147 tMethod_added,
148 tSingleton_method_added,
149 tMethod_removed,
150 tSingleton_method_removed,
151 tMethod_undefined,
152 tSingleton_method_undefined,
153 tLength,
154 tSize,
155 tGets,
156 tSucc,
157 tEach,
158 tProc,
159 tLambda,
160 tSend,
161 t__send__,
162 t__recursive_key__,
163 tInitialize,
164 tInitialize_copy,
165 tInitialize_clone,
166 tInitialize_dup,
167 tTo_int,
168 tTo_ary,
169 tTo_str,
170 tTo_sym,
171 tTo_hash,
172 tTo_proc,
173 tTo_io,
174 tTo_a,
175 tTo_s,
176 tTo_i,
177 tTo_f,
178 tTo_r,
179 tBt,
180 tBt_locations,
181 tCall,
182 tMesg,
183 tException,
184 tLocals,
185 tNOT,
186 tAND,
187 tOR,
188 tDiv,
189 tDivmod,
190 tFdiv,
191 tQuo,
192 tName,
193 tNil,
194 tPath,
195 tPack,
196 tBuffer,
197 tUScore,
198 tNUMPARAM_1,
199 tNUMPARAM_2,
200 tNUMPARAM_3,
201 tNUMPARAM_4,
202 tNUMPARAM_5,
203 tNUMPARAM_6,
204 tNUMPARAM_7,
205 tNUMPARAM_8,
206 tNUMPARAM_9,
207 tDefault,
208 tTOKEN_LOCAL_END,
209 /* LOCAL tokens }}} */
210
211 /* INSTANCE tokens {{{ */
212 tTOKEN_INSTANCE_BEGIN = tTOKEN_LOCAL_END-1,
213 tTOKEN_INSTANCE_END,
214 /* INSTANCE tokens }}} */
215
216 /* GLOBAL tokens {{{ */
217 tTOKEN_GLOBAL_BEGIN = tTOKEN_INSTANCE_END-1,
218 tLASTLINE,
219 tBACKREF,
220 tERROR_INFO,
221 tTOKEN_GLOBAL_END,
222 /* GLOBAL tokens }}} */
223
224 /* CONST tokens {{{ */
225 tTOKEN_CONST_BEGIN = tTOKEN_GLOBAL_END-1,
226 tRuby,
227 tTOKEN_CONST_END,
228 /* CONST tokens }}} */
229
230 /* CLASS tokens {{{ */
231 tTOKEN_CLASS_BEGIN = tTOKEN_CONST_END-1,
232 tTOKEN_CLASS_END,
233 /* CLASS tokens }}} */
234
235 /* ATTRSET tokens {{{ */
236 tTOKEN_ATTRSET_BEGIN = tTOKEN_CLASS_END-1,
237 tTOKEN_ATTRSET_END,
238 /* ATTRSET tokens }}} */
239
240 tNEXT_ID = tTOKEN_ATTRSET_END,
241
242 /* LOCAL IDs {{{ */
243#define DEFINE_LOCALID_FROM_TOKEN(n) id##n = TOKEN2LOCALID(t##n)
244 DEFINE_LOCALID_FROM_TOKEN(Max),
245 DEFINE_LOCALID_FROM_TOKEN(Min),
246 DEFINE_LOCALID_FROM_TOKEN(Hash),
247 DEFINE_LOCALID_FROM_TOKEN(Freeze),
248 DEFINE_LOCALID_FROM_TOKEN(Inspect),
249 DEFINE_LOCALID_FROM_TOKEN(Intern),
250 DEFINE_LOCALID_FROM_TOKEN(Object_id),
251 DEFINE_LOCALID_FROM_TOKEN(__id__),
252 DEFINE_LOCALID_FROM_TOKEN(Const_added),
253 DEFINE_LOCALID_FROM_TOKEN(Const_missing),
254 DEFINE_LOCALID_FROM_TOKEN(MethodMissing),
255 DEFINE_LOCALID_FROM_TOKEN(Method_added),
256 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_added),
257 DEFINE_LOCALID_FROM_TOKEN(Method_removed),
258 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_removed),
259 DEFINE_LOCALID_FROM_TOKEN(Method_undefined),
260 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_undefined),
261 DEFINE_LOCALID_FROM_TOKEN(Length),
262 DEFINE_LOCALID_FROM_TOKEN(Size),
263 DEFINE_LOCALID_FROM_TOKEN(Gets),
264 DEFINE_LOCALID_FROM_TOKEN(Succ),
265 DEFINE_LOCALID_FROM_TOKEN(Each),
266 DEFINE_LOCALID_FROM_TOKEN(Proc),
267 DEFINE_LOCALID_FROM_TOKEN(Lambda),
268 DEFINE_LOCALID_FROM_TOKEN(Send),
269 DEFINE_LOCALID_FROM_TOKEN(__send__),
270 DEFINE_LOCALID_FROM_TOKEN(__recursive_key__),
271 DEFINE_LOCALID_FROM_TOKEN(Initialize),
272 DEFINE_LOCALID_FROM_TOKEN(Initialize_copy),
273 DEFINE_LOCALID_FROM_TOKEN(Initialize_clone),
274 DEFINE_LOCALID_FROM_TOKEN(Initialize_dup),
275 DEFINE_LOCALID_FROM_TOKEN(To_int),
276 DEFINE_LOCALID_FROM_TOKEN(To_ary),
277 DEFINE_LOCALID_FROM_TOKEN(To_str),
278 DEFINE_LOCALID_FROM_TOKEN(To_sym),
279 DEFINE_LOCALID_FROM_TOKEN(To_hash),
280 DEFINE_LOCALID_FROM_TOKEN(To_proc),
281 DEFINE_LOCALID_FROM_TOKEN(To_io),
282 DEFINE_LOCALID_FROM_TOKEN(To_a),
283 DEFINE_LOCALID_FROM_TOKEN(To_s),
284 DEFINE_LOCALID_FROM_TOKEN(To_i),
285 DEFINE_LOCALID_FROM_TOKEN(To_f),
286 DEFINE_LOCALID_FROM_TOKEN(To_r),
287 DEFINE_LOCALID_FROM_TOKEN(Bt),
288 DEFINE_LOCALID_FROM_TOKEN(Bt_locations),
289 DEFINE_LOCALID_FROM_TOKEN(Call),
290 DEFINE_LOCALID_FROM_TOKEN(Mesg),
291 DEFINE_LOCALID_FROM_TOKEN(Exception),
292 DEFINE_LOCALID_FROM_TOKEN(Locals),
293 DEFINE_LOCALID_FROM_TOKEN(NOT),
294 DEFINE_LOCALID_FROM_TOKEN(AND),
295 DEFINE_LOCALID_FROM_TOKEN(OR),
296 DEFINE_LOCALID_FROM_TOKEN(Div),
297 DEFINE_LOCALID_FROM_TOKEN(Divmod),
298 DEFINE_LOCALID_FROM_TOKEN(Fdiv),
299 DEFINE_LOCALID_FROM_TOKEN(Quo),
300 DEFINE_LOCALID_FROM_TOKEN(Name),
301 DEFINE_LOCALID_FROM_TOKEN(Nil),
302 DEFINE_LOCALID_FROM_TOKEN(Path),
303 DEFINE_LOCALID_FROM_TOKEN(Pack),
304 DEFINE_LOCALID_FROM_TOKEN(Buffer),
305 DEFINE_LOCALID_FROM_TOKEN(UScore),
306 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_1),
307 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_2),
308 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_3),
309 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_4),
310 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_5),
311 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_6),
312 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_7),
313 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_8),
314 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_9),
315 DEFINE_LOCALID_FROM_TOKEN(Default),
316#undef DEFINE_LOCALID_FROM_TOKEN
317 /* LOCAL IDs }}} */
318
319 /* INSTANCE IDs {{{ */
320#define DEFINE_INSTANCEID_FROM_TOKEN(n) id##n = TOKEN2INSTANCEID(t##n)
321#undef DEFINE_INSTANCEID_FROM_TOKEN
322 /* INSTANCE IDs }}} */
323
324 /* GLOBAL IDs {{{ */
325#define DEFINE_GLOBALID_FROM_TOKEN(n) id##n = TOKEN2GLOBALID(t##n)
326 DEFINE_GLOBALID_FROM_TOKEN(LASTLINE),
327 DEFINE_GLOBALID_FROM_TOKEN(BACKREF),
328 DEFINE_GLOBALID_FROM_TOKEN(ERROR_INFO),
329#undef DEFINE_GLOBALID_FROM_TOKEN
330 /* GLOBAL IDs }}} */
331
332 /* CONST IDs {{{ */
333#define DEFINE_CONSTID_FROM_TOKEN(n) id##n = TOKEN2CONSTID(t##n)
334 DEFINE_CONSTID_FROM_TOKEN(Ruby),
335#undef DEFINE_CONSTID_FROM_TOKEN
336 /* CONST IDs }}} */
337
338 /* CLASS IDs {{{ */
339#define DEFINE_CLASSID_FROM_TOKEN(n) id##n = TOKEN2CLASSID(t##n)
340#undef DEFINE_CLASSID_FROM_TOKEN
341 /* CLASS IDs }}} */
342
343 /* ATTRSET IDs {{{ */
344#define DEFINE_ATTRSETID_FROM_TOKEN(n) id##n = TOKEN2ATTRSETID(t##n)
345#undef DEFINE_ATTRSETID_FROM_TOKEN
346 /* ATTRSET IDs }}} */
347
348 tLAST_OP_ID = tPRESERVED_ID_END-1,
349 idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
350};
351
352#endif /* RUBY_ID_H */
Definition dtoa.c:305