debase-ruby_core_source 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/addr2line.h +21 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ccan/list/list.h +773 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/constant.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/debug_counter.h +109 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/dln.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/eval_intern.h +334 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/gc.h +116 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/id.h +250 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/id_table.h +31 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/insns.inc +217 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/insns_info.inc +1570 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/internal.h +2036 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/iseq.h +307 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/known_errors.inc +746 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/method.h +218 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/node.h +540 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/node_name.inc +198 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/opt_sc.inc +1601 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/optinsn.inc +103 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/optunifs.inc +61 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/parse.h +206 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/probes_helper.h +43 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/regenc.h +254 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/regint.h +938 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/regparse.h +370 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/revision.h +1 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ruby_assert.h +54 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/ruby_atomic.h +233 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/symbol.h +108 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/thread_pthread.h +54 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/thread_win32.h +36 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/timev.h +42 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/transcode_data.h +139 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/version.h +73 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm.inc +3667 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_call_iseq_optimized.inc +213 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_core.h +1767 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_debug.h +37 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_exec.h +192 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_insnhelper.h +255 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vm_opts.h +56 -0
- data/lib/debase/ruby_core_source/ruby-2.5.1-p57/vmtc.inc +214 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +51 -3
@@ -0,0 +1,218 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
method.h -
|
4
|
+
|
5
|
+
$Author: mame $
|
6
|
+
created at: Wed Jul 15 20:02:33 2009
|
7
|
+
|
8
|
+
Copyright (C) 2009 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
#ifndef RUBY_METHOD_H
|
12
|
+
#define RUBY_METHOD_H 1
|
13
|
+
|
14
|
+
#include "internal.h"
|
15
|
+
|
16
|
+
#ifndef END_OF_ENUMERATION
|
17
|
+
# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
|
18
|
+
# define END_OF_ENUMERATION(key)
|
19
|
+
# else
|
20
|
+
# define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
|
24
|
+
/* cref */
|
25
|
+
|
26
|
+
typedef enum {
|
27
|
+
METHOD_VISI_UNDEF = 0x00,
|
28
|
+
METHOD_VISI_PUBLIC = 0x01,
|
29
|
+
METHOD_VISI_PRIVATE = 0x02,
|
30
|
+
METHOD_VISI_PROTECTED = 0x03,
|
31
|
+
|
32
|
+
METHOD_VISI_MASK = 0x03
|
33
|
+
} rb_method_visibility_t;
|
34
|
+
|
35
|
+
typedef struct rb_scope_visi_struct {
|
36
|
+
rb_method_visibility_t method_visi : 3;
|
37
|
+
unsigned int module_func : 1;
|
38
|
+
} rb_scope_visibility_t;
|
39
|
+
|
40
|
+
/*! CREF (Class REFerence) */
|
41
|
+
typedef struct rb_cref_struct {
|
42
|
+
VALUE flags;
|
43
|
+
const VALUE refinements;
|
44
|
+
const VALUE klass;
|
45
|
+
struct rb_cref_struct * const next;
|
46
|
+
const rb_scope_visibility_t scope_visi;
|
47
|
+
} rb_cref_t;
|
48
|
+
|
49
|
+
/* method data type */
|
50
|
+
|
51
|
+
typedef struct rb_method_entry_struct {
|
52
|
+
VALUE flags;
|
53
|
+
const VALUE defined_class;
|
54
|
+
struct rb_method_definition_struct * const def;
|
55
|
+
ID called_id;
|
56
|
+
const VALUE owner;
|
57
|
+
} rb_method_entry_t;
|
58
|
+
|
59
|
+
typedef struct rb_callable_method_entry_struct { /* same fields with rb_method_entry_t */
|
60
|
+
VALUE flags;
|
61
|
+
const VALUE defined_class;
|
62
|
+
struct rb_method_definition_struct * const def;
|
63
|
+
ID called_id;
|
64
|
+
const VALUE owner;
|
65
|
+
} rb_callable_method_entry_t;
|
66
|
+
|
67
|
+
#define METHOD_ENTRY_VISI(me) (rb_method_visibility_t)(((me)->flags & (IMEMO_FL_USER0 | IMEMO_FL_USER1)) >> (IMEMO_FL_USHIFT+0))
|
68
|
+
#define METHOD_ENTRY_BASIC(me) (int) (((me)->flags & (IMEMO_FL_USER2 )) >> (IMEMO_FL_USHIFT+2))
|
69
|
+
#define METHOD_ENTRY_COMPLEMENTED(me) ((me)->flags & IMEMO_FL_USER3)
|
70
|
+
#define METHOD_ENTRY_COMPLEMENTED_SET(me) ((me)->flags = (me)->flags | IMEMO_FL_USER3)
|
71
|
+
|
72
|
+
static inline void
|
73
|
+
METHOD_ENTRY_VISI_SET(rb_method_entry_t *me, rb_method_visibility_t visi)
|
74
|
+
{
|
75
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
76
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER0 | IMEMO_FL_USER1)) | (visi << (IMEMO_FL_USHIFT+0));
|
77
|
+
}
|
78
|
+
static inline void
|
79
|
+
METHOD_ENTRY_BASIC_SET(rb_method_entry_t *me, unsigned int basic)
|
80
|
+
{
|
81
|
+
VM_ASSERT(basic <= 1);
|
82
|
+
me->flags = (me->flags & ~(IMEMO_FL_USER2 )) | (basic << (IMEMO_FL_USHIFT+2));
|
83
|
+
}
|
84
|
+
static inline void
|
85
|
+
METHOD_ENTRY_FLAGS_SET(rb_method_entry_t *me, rb_method_visibility_t visi, unsigned int basic)
|
86
|
+
{
|
87
|
+
VM_ASSERT((int)visi >= 0 && visi <= 3);
|
88
|
+
VM_ASSERT(basic <= 1);
|
89
|
+
me->flags =
|
90
|
+
(me->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
91
|
+
((visi << (IMEMO_FL_USHIFT+0)) | (basic << (IMEMO_FL_USHIFT+2)));
|
92
|
+
}
|
93
|
+
static inline void
|
94
|
+
METHOD_ENTRY_FLAGS_COPY(rb_method_entry_t *dst, const rb_method_entry_t *src)
|
95
|
+
{
|
96
|
+
dst->flags =
|
97
|
+
(dst->flags & ~(IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2)) |
|
98
|
+
(src->flags & (IMEMO_FL_USER0|IMEMO_FL_USER1|IMEMO_FL_USER2));
|
99
|
+
}
|
100
|
+
|
101
|
+
typedef enum {
|
102
|
+
VM_METHOD_TYPE_ISEQ, /*!< Ruby method */
|
103
|
+
VM_METHOD_TYPE_CFUNC, /*!< C method */
|
104
|
+
VM_METHOD_TYPE_ATTRSET, /*!< attr_writer or attr_accessor */
|
105
|
+
VM_METHOD_TYPE_IVAR, /*!< attr_reader or attr_accessor */
|
106
|
+
VM_METHOD_TYPE_BMETHOD,
|
107
|
+
VM_METHOD_TYPE_ZSUPER,
|
108
|
+
VM_METHOD_TYPE_ALIAS,
|
109
|
+
VM_METHOD_TYPE_UNDEF,
|
110
|
+
VM_METHOD_TYPE_NOTIMPLEMENTED,
|
111
|
+
VM_METHOD_TYPE_OPTIMIZED, /*!< Kernel#send, Proc#call, etc */
|
112
|
+
VM_METHOD_TYPE_MISSING, /*!< wrapper for method_missing(id) */
|
113
|
+
VM_METHOD_TYPE_REFINED, /*!< refinement */
|
114
|
+
|
115
|
+
END_OF_ENUMERATION(VM_METHOD_TYPE)
|
116
|
+
} rb_method_type_t;
|
117
|
+
|
118
|
+
#ifndef rb_iseq_t
|
119
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
120
|
+
#define rb_iseq_t rb_iseq_t
|
121
|
+
#endif
|
122
|
+
|
123
|
+
typedef struct rb_method_iseq_struct {
|
124
|
+
const rb_iseq_t * const iseqptr; /*!< iseq pointer, should be separated from iseqval */
|
125
|
+
rb_cref_t * const cref; /*!< class reference, should be marked */
|
126
|
+
} rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */
|
127
|
+
|
128
|
+
typedef struct rb_method_cfunc_struct {
|
129
|
+
VALUE (*func)(ANYARGS);
|
130
|
+
VALUE (*invoker)(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv);
|
131
|
+
int argc;
|
132
|
+
} rb_method_cfunc_t;
|
133
|
+
|
134
|
+
typedef struct rb_method_attr_struct {
|
135
|
+
ID id;
|
136
|
+
const VALUE location; /* should be marked */
|
137
|
+
} rb_method_attr_t;
|
138
|
+
|
139
|
+
typedef struct rb_method_alias_struct {
|
140
|
+
const struct rb_method_entry_struct * const original_me; /* original_me->klass is original owner */
|
141
|
+
} rb_method_alias_t;
|
142
|
+
|
143
|
+
typedef struct rb_method_refined_struct {
|
144
|
+
const struct rb_method_entry_struct * const orig_me;
|
145
|
+
const VALUE owner;
|
146
|
+
} rb_method_refined_t;
|
147
|
+
|
148
|
+
enum method_optimized_type {
|
149
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
150
|
+
OPTIMIZED_METHOD_TYPE_CALL,
|
151
|
+
OPTIMIZED_METHOD_TYPE__MAX
|
152
|
+
};
|
153
|
+
|
154
|
+
PACKED_STRUCT_UNALIGNED(struct rb_method_definition_struct {
|
155
|
+
unsigned int type : 4; /* method type */
|
156
|
+
int alias_count : 28;
|
157
|
+
int complemented_count : 28;
|
158
|
+
|
159
|
+
union {
|
160
|
+
rb_method_iseq_t iseq;
|
161
|
+
rb_method_cfunc_t cfunc;
|
162
|
+
rb_method_attr_t attr;
|
163
|
+
rb_method_alias_t alias;
|
164
|
+
rb_method_refined_t refined;
|
165
|
+
|
166
|
+
const VALUE proc; /* should be marked */
|
167
|
+
enum method_optimized_type optimize_type;
|
168
|
+
} body;
|
169
|
+
|
170
|
+
ID original_id;
|
171
|
+
});
|
172
|
+
|
173
|
+
typedef struct rb_method_definition_struct rb_method_definition_t;
|
174
|
+
|
175
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
176
|
+
#define UNDEFINED_REFINED_METHOD_P(def) \
|
177
|
+
((def)->type == VM_METHOD_TYPE_REFINED && \
|
178
|
+
UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me))
|
179
|
+
|
180
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi);
|
181
|
+
void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi);
|
182
|
+
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
|
183
|
+
|
184
|
+
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi);
|
185
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
|
186
|
+
rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
|
187
|
+
|
188
|
+
const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
|
189
|
+
|
190
|
+
const rb_method_entry_t *rb_method_entry(VALUE klass, ID id);
|
191
|
+
const rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
192
|
+
const rb_method_entry_t *rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
|
193
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
194
|
+
const rb_method_entry_t *rb_resolve_me_location(const rb_method_entry_t *, VALUE[5]);
|
195
|
+
RUBY_SYMBOL_EXPORT_END
|
196
|
+
|
197
|
+
const rb_callable_method_entry_t *rb_callable_method_entry(VALUE klass, ID id);
|
198
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_with_refinements(VALUE klass, ID id, VALUE *defined_class);
|
199
|
+
const rb_callable_method_entry_t *rb_callable_method_entry_without_refinements(VALUE klass, ID id, VALUE *defined_class);
|
200
|
+
|
201
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
202
|
+
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
|
203
|
+
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
|
204
|
+
|
205
|
+
VALUE rb_method_entry_location(const rb_method_entry_t *me);
|
206
|
+
VALUE rb_mod_method_location(VALUE mod, ID id);
|
207
|
+
VALUE rb_obj_method_location(VALUE obj, ID id);
|
208
|
+
|
209
|
+
void rb_free_method_entry(const rb_method_entry_t *me);
|
210
|
+
void rb_sweep_method_entry(void *vm);
|
211
|
+
|
212
|
+
const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
|
213
|
+
const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
|
214
|
+
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
|
215
|
+
|
216
|
+
void rb_scope_visibility_set(rb_method_visibility_t);
|
217
|
+
|
218
|
+
#endif /* RUBY_METHOD_H */
|
@@ -0,0 +1,540 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
node.h -
|
4
|
+
|
5
|
+
$Author: mame $
|
6
|
+
created at: Fri May 28 15:14:02 JST 1993
|
7
|
+
|
8
|
+
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_NODE_H
|
13
|
+
#define RUBY_NODE_H 1
|
14
|
+
|
15
|
+
#if defined(__cplusplus)
|
16
|
+
extern "C" {
|
17
|
+
#if 0
|
18
|
+
} /* satisfy cc-mode */
|
19
|
+
#endif
|
20
|
+
#endif
|
21
|
+
|
22
|
+
enum node_type {
|
23
|
+
NODE_SCOPE,
|
24
|
+
#define NODE_SCOPE NODE_SCOPE
|
25
|
+
NODE_BLOCK,
|
26
|
+
#define NODE_BLOCK NODE_BLOCK
|
27
|
+
NODE_IF,
|
28
|
+
#define NODE_IF NODE_IF
|
29
|
+
NODE_UNLESS,
|
30
|
+
#define NODE_UNLESS NODE_UNLESS
|
31
|
+
NODE_CASE,
|
32
|
+
#define NODE_CASE NODE_CASE
|
33
|
+
NODE_CASE2,
|
34
|
+
#define NODE_CASE2 NODE_CASE2
|
35
|
+
NODE_WHEN,
|
36
|
+
#define NODE_WHEN NODE_WHEN
|
37
|
+
NODE_WHILE,
|
38
|
+
#define NODE_WHILE NODE_WHILE
|
39
|
+
NODE_UNTIL,
|
40
|
+
#define NODE_UNTIL NODE_UNTIL
|
41
|
+
NODE_ITER,
|
42
|
+
#define NODE_ITER NODE_ITER
|
43
|
+
NODE_FOR,
|
44
|
+
#define NODE_FOR NODE_FOR
|
45
|
+
NODE_BREAK,
|
46
|
+
#define NODE_BREAK NODE_BREAK
|
47
|
+
NODE_NEXT,
|
48
|
+
#define NODE_NEXT NODE_NEXT
|
49
|
+
NODE_REDO,
|
50
|
+
#define NODE_REDO NODE_REDO
|
51
|
+
NODE_RETRY,
|
52
|
+
#define NODE_RETRY NODE_RETRY
|
53
|
+
NODE_BEGIN,
|
54
|
+
#define NODE_BEGIN NODE_BEGIN
|
55
|
+
NODE_RESCUE,
|
56
|
+
#define NODE_RESCUE NODE_RESCUE
|
57
|
+
NODE_RESBODY,
|
58
|
+
#define NODE_RESBODY NODE_RESBODY
|
59
|
+
NODE_ENSURE,
|
60
|
+
#define NODE_ENSURE NODE_ENSURE
|
61
|
+
NODE_AND,
|
62
|
+
#define NODE_AND NODE_AND
|
63
|
+
NODE_OR,
|
64
|
+
#define NODE_OR NODE_OR
|
65
|
+
NODE_MASGN,
|
66
|
+
#define NODE_MASGN NODE_MASGN
|
67
|
+
NODE_LASGN,
|
68
|
+
#define NODE_LASGN NODE_LASGN
|
69
|
+
NODE_DASGN,
|
70
|
+
#define NODE_DASGN NODE_DASGN
|
71
|
+
NODE_DASGN_CURR,
|
72
|
+
#define NODE_DASGN_CURR NODE_DASGN_CURR
|
73
|
+
NODE_GASGN,
|
74
|
+
#define NODE_GASGN NODE_GASGN
|
75
|
+
NODE_IASGN,
|
76
|
+
#define NODE_IASGN NODE_IASGN
|
77
|
+
NODE_CDECL,
|
78
|
+
#define NODE_CDECL NODE_CDECL
|
79
|
+
NODE_CVASGN,
|
80
|
+
#define NODE_CVASGN NODE_CVASGN
|
81
|
+
NODE_OP_ASGN1,
|
82
|
+
#define NODE_OP_ASGN1 NODE_OP_ASGN1
|
83
|
+
NODE_OP_ASGN2,
|
84
|
+
#define NODE_OP_ASGN2 NODE_OP_ASGN2
|
85
|
+
NODE_OP_ASGN_AND,
|
86
|
+
#define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
|
87
|
+
NODE_OP_ASGN_OR,
|
88
|
+
#define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
|
89
|
+
NODE_OP_CDECL,
|
90
|
+
#define NODE_OP_CDECL NODE_OP_CDECL
|
91
|
+
NODE_CALL,
|
92
|
+
#define NODE_CALL NODE_CALL
|
93
|
+
NODE_OPCALL,
|
94
|
+
#define NODE_OPCALL NODE_OPCALL
|
95
|
+
NODE_FCALL,
|
96
|
+
#define NODE_FCALL NODE_FCALL
|
97
|
+
NODE_VCALL,
|
98
|
+
#define NODE_VCALL NODE_VCALL
|
99
|
+
NODE_QCALL,
|
100
|
+
#define NODE_QCALL NODE_QCALL
|
101
|
+
NODE_SUPER,
|
102
|
+
#define NODE_SUPER NODE_SUPER
|
103
|
+
NODE_ZSUPER,
|
104
|
+
#define NODE_ZSUPER NODE_ZSUPER
|
105
|
+
NODE_ARRAY,
|
106
|
+
#define NODE_ARRAY NODE_ARRAY
|
107
|
+
NODE_ZARRAY,
|
108
|
+
#define NODE_ZARRAY NODE_ZARRAY
|
109
|
+
NODE_VALUES,
|
110
|
+
#define NODE_VALUES NODE_VALUES
|
111
|
+
NODE_HASH,
|
112
|
+
#define NODE_HASH NODE_HASH
|
113
|
+
NODE_RETURN,
|
114
|
+
#define NODE_RETURN NODE_RETURN
|
115
|
+
NODE_YIELD,
|
116
|
+
#define NODE_YIELD NODE_YIELD
|
117
|
+
NODE_LVAR,
|
118
|
+
#define NODE_LVAR NODE_LVAR
|
119
|
+
NODE_DVAR,
|
120
|
+
#define NODE_DVAR NODE_DVAR
|
121
|
+
NODE_GVAR,
|
122
|
+
#define NODE_GVAR NODE_GVAR
|
123
|
+
NODE_IVAR,
|
124
|
+
#define NODE_IVAR NODE_IVAR
|
125
|
+
NODE_CONST,
|
126
|
+
#define NODE_CONST NODE_CONST
|
127
|
+
NODE_CVAR,
|
128
|
+
#define NODE_CVAR NODE_CVAR
|
129
|
+
NODE_NTH_REF,
|
130
|
+
#define NODE_NTH_REF NODE_NTH_REF
|
131
|
+
NODE_BACK_REF,
|
132
|
+
#define NODE_BACK_REF NODE_BACK_REF
|
133
|
+
NODE_MATCH,
|
134
|
+
#define NODE_MATCH NODE_MATCH
|
135
|
+
NODE_MATCH2,
|
136
|
+
#define NODE_MATCH2 NODE_MATCH2
|
137
|
+
NODE_MATCH3,
|
138
|
+
#define NODE_MATCH3 NODE_MATCH3
|
139
|
+
NODE_LIT,
|
140
|
+
#define NODE_LIT NODE_LIT
|
141
|
+
NODE_STR,
|
142
|
+
#define NODE_STR NODE_STR
|
143
|
+
NODE_DSTR,
|
144
|
+
#define NODE_DSTR NODE_DSTR
|
145
|
+
NODE_XSTR,
|
146
|
+
#define NODE_XSTR NODE_XSTR
|
147
|
+
NODE_DXSTR,
|
148
|
+
#define NODE_DXSTR NODE_DXSTR
|
149
|
+
NODE_EVSTR,
|
150
|
+
#define NODE_EVSTR NODE_EVSTR
|
151
|
+
NODE_DREGX,
|
152
|
+
#define NODE_DREGX NODE_DREGX
|
153
|
+
NODE_ARGS,
|
154
|
+
#define NODE_ARGS NODE_ARGS
|
155
|
+
NODE_ARGS_AUX,
|
156
|
+
#define NODE_ARGS_AUX NODE_ARGS_AUX
|
157
|
+
NODE_OPT_ARG,
|
158
|
+
#define NODE_OPT_ARG NODE_OPT_ARG
|
159
|
+
NODE_KW_ARG,
|
160
|
+
#define NODE_KW_ARG NODE_KW_ARG
|
161
|
+
NODE_POSTARG,
|
162
|
+
#define NODE_POSTARG NODE_POSTARG
|
163
|
+
NODE_ARGSCAT,
|
164
|
+
#define NODE_ARGSCAT NODE_ARGSCAT
|
165
|
+
NODE_ARGSPUSH,
|
166
|
+
#define NODE_ARGSPUSH NODE_ARGSPUSH
|
167
|
+
NODE_SPLAT,
|
168
|
+
#define NODE_SPLAT NODE_SPLAT
|
169
|
+
NODE_BLOCK_PASS,
|
170
|
+
#define NODE_BLOCK_PASS NODE_BLOCK_PASS
|
171
|
+
NODE_DEFN,
|
172
|
+
#define NODE_DEFN NODE_DEFN
|
173
|
+
NODE_DEFS,
|
174
|
+
#define NODE_DEFS NODE_DEFS
|
175
|
+
NODE_ALIAS,
|
176
|
+
#define NODE_ALIAS NODE_ALIAS
|
177
|
+
NODE_VALIAS,
|
178
|
+
#define NODE_VALIAS NODE_VALIAS
|
179
|
+
NODE_UNDEF,
|
180
|
+
#define NODE_UNDEF NODE_UNDEF
|
181
|
+
NODE_CLASS,
|
182
|
+
#define NODE_CLASS NODE_CLASS
|
183
|
+
NODE_MODULE,
|
184
|
+
#define NODE_MODULE NODE_MODULE
|
185
|
+
NODE_SCLASS,
|
186
|
+
#define NODE_SCLASS NODE_SCLASS
|
187
|
+
NODE_COLON2,
|
188
|
+
#define NODE_COLON2 NODE_COLON2
|
189
|
+
NODE_COLON3,
|
190
|
+
#define NODE_COLON3 NODE_COLON3
|
191
|
+
NODE_DOT2,
|
192
|
+
#define NODE_DOT2 NODE_DOT2
|
193
|
+
NODE_DOT3,
|
194
|
+
#define NODE_DOT3 NODE_DOT3
|
195
|
+
NODE_FLIP2,
|
196
|
+
#define NODE_FLIP2 NODE_FLIP2
|
197
|
+
NODE_FLIP3,
|
198
|
+
#define NODE_FLIP3 NODE_FLIP3
|
199
|
+
NODE_SELF,
|
200
|
+
#define NODE_SELF NODE_SELF
|
201
|
+
NODE_NIL,
|
202
|
+
#define NODE_NIL NODE_NIL
|
203
|
+
NODE_TRUE,
|
204
|
+
#define NODE_TRUE NODE_TRUE
|
205
|
+
NODE_FALSE,
|
206
|
+
#define NODE_FALSE NODE_FALSE
|
207
|
+
NODE_ERRINFO,
|
208
|
+
#define NODE_ERRINFO NODE_ERRINFO
|
209
|
+
NODE_DEFINED,
|
210
|
+
#define NODE_DEFINED NODE_DEFINED
|
211
|
+
NODE_POSTEXE,
|
212
|
+
#define NODE_POSTEXE NODE_POSTEXE
|
213
|
+
NODE_DSYM,
|
214
|
+
#define NODE_DSYM NODE_DSYM
|
215
|
+
NODE_ATTRASGN,
|
216
|
+
#define NODE_ATTRASGN NODE_ATTRASGN
|
217
|
+
NODE_PRELUDE,
|
218
|
+
#define NODE_PRELUDE NODE_PRELUDE
|
219
|
+
NODE_LAMBDA,
|
220
|
+
#define NODE_LAMBDA NODE_LAMBDA
|
221
|
+
NODE_LAST
|
222
|
+
#define NODE_LAST NODE_LAST
|
223
|
+
};
|
224
|
+
|
225
|
+
typedef struct rb_code_location_struct {
|
226
|
+
int lineno;
|
227
|
+
int column;
|
228
|
+
} rb_code_location_t;
|
229
|
+
|
230
|
+
typedef struct rb_code_range_struct {
|
231
|
+
rb_code_location_t first_loc;
|
232
|
+
rb_code_location_t last_loc;
|
233
|
+
} rb_code_range_t;
|
234
|
+
|
235
|
+
typedef struct RNode {
|
236
|
+
VALUE flags;
|
237
|
+
union {
|
238
|
+
struct RNode *node;
|
239
|
+
ID id;
|
240
|
+
VALUE value;
|
241
|
+
VALUE (*cfunc)(ANYARGS);
|
242
|
+
ID *tbl;
|
243
|
+
} u1;
|
244
|
+
union {
|
245
|
+
struct RNode *node;
|
246
|
+
ID id;
|
247
|
+
long argc;
|
248
|
+
VALUE value;
|
249
|
+
} u2;
|
250
|
+
union {
|
251
|
+
struct RNode *node;
|
252
|
+
ID id;
|
253
|
+
long state;
|
254
|
+
struct rb_global_entry *entry;
|
255
|
+
struct rb_args_info *args;
|
256
|
+
long cnt;
|
257
|
+
VALUE value;
|
258
|
+
} u3;
|
259
|
+
rb_code_range_t nd_loc;
|
260
|
+
} NODE;
|
261
|
+
|
262
|
+
#define RNODE(obj) (R_CAST(RNode)(obj))
|
263
|
+
|
264
|
+
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTED, 10: EXIVAR, 11: FREEZE */
|
265
|
+
/* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
|
266
|
+
* 8..14: nd_type,
|
267
|
+
* 15..: nd_line
|
268
|
+
*/
|
269
|
+
#define NODE_FL_NEWLINE (((VALUE)1)<<7)
|
270
|
+
|
271
|
+
#define NODE_TYPESHIFT 8
|
272
|
+
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
|
273
|
+
|
274
|
+
#define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
|
275
|
+
#define nd_set_type(n,t) \
|
276
|
+
(n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
|
277
|
+
|
278
|
+
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
|
279
|
+
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
|
280
|
+
#define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT)
|
281
|
+
#define nd_set_line(n,l) \
|
282
|
+
(n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
|
283
|
+
|
284
|
+
#define nd_first_column(n) ((int)((n)->nd_loc.first_loc.column))
|
285
|
+
#define nd_set_first_column(n, v) ((n)->nd_loc.first_loc.column = (v))
|
286
|
+
#define nd_first_lineno(n) ((int)((n)->nd_loc.first_loc.lineno))
|
287
|
+
#define nd_set_first_lineno(n, v) ((n)->nd_loc.first_loc.lineno = (v))
|
288
|
+
|
289
|
+
#define nd_last_column(n) ((int)((n)->nd_loc.last_loc.column))
|
290
|
+
#define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
|
291
|
+
#define nd_last_lineno(n) ((int)((n)->nd_loc.last_loc.lineno))
|
292
|
+
#define nd_set_last_lineno(n, v) ((n)->nd_loc.last_loc.lineno = (v))
|
293
|
+
#define nd_last_loc(n) ((n)->nd_loc.last_loc)
|
294
|
+
#define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
|
295
|
+
|
296
|
+
#define nd_head u1.node
|
297
|
+
#define nd_alen u2.argc
|
298
|
+
#define nd_next u3.node
|
299
|
+
|
300
|
+
#define nd_cond u1.node
|
301
|
+
#define nd_body u2.node
|
302
|
+
#define nd_else u3.node
|
303
|
+
|
304
|
+
#define nd_resq u2.node
|
305
|
+
#define nd_ensr u3.node
|
306
|
+
|
307
|
+
#define nd_1st u1.node
|
308
|
+
#define nd_2nd u2.node
|
309
|
+
|
310
|
+
#define nd_stts u1.node
|
311
|
+
|
312
|
+
#define nd_entry u3.entry
|
313
|
+
#define nd_vid u1.id
|
314
|
+
#define nd_cflag u2.id
|
315
|
+
#define nd_cval u3.value
|
316
|
+
|
317
|
+
#define nd_oid u1.id
|
318
|
+
#define nd_cnt u3.cnt
|
319
|
+
#define nd_tbl u1.tbl
|
320
|
+
|
321
|
+
#define nd_var u1.node
|
322
|
+
#define nd_iter u3.node
|
323
|
+
|
324
|
+
#define nd_value u2.node
|
325
|
+
#define nd_aid u3.id
|
326
|
+
|
327
|
+
#define nd_lit u1.value
|
328
|
+
|
329
|
+
#define nd_frml u2.argc
|
330
|
+
#define nd_rest u1.id
|
331
|
+
#define nd_opt u1.node
|
332
|
+
#define nd_pid u1.id
|
333
|
+
#define nd_plen u2.argc
|
334
|
+
|
335
|
+
#define nd_recv u1.node
|
336
|
+
#define nd_mid u2.id
|
337
|
+
#define nd_args u3.node
|
338
|
+
#define nd_ainfo u3.args
|
339
|
+
|
340
|
+
#define nd_noex u3.id
|
341
|
+
#define nd_defn u3.node
|
342
|
+
|
343
|
+
#define nd_cfnc u1.cfunc
|
344
|
+
#define nd_argc u2.argc
|
345
|
+
|
346
|
+
#define nd_cpath u1.node
|
347
|
+
#define nd_super u3.node
|
348
|
+
|
349
|
+
#define nd_beg u1.node
|
350
|
+
#define nd_end u2.node
|
351
|
+
#define nd_state u3.state
|
352
|
+
#define nd_rval u2.value
|
353
|
+
|
354
|
+
#define nd_nth u2.argc
|
355
|
+
|
356
|
+
#define nd_tag u1.id
|
357
|
+
|
358
|
+
#define nd_alias u1.id
|
359
|
+
#define nd_orig u2.id
|
360
|
+
#define nd_undef u2.node
|
361
|
+
|
362
|
+
#define nd_compile_option u3.value
|
363
|
+
|
364
|
+
#define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
|
365
|
+
|
366
|
+
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
|
367
|
+
#define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
|
368
|
+
#define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
|
369
|
+
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
|
370
|
+
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
|
371
|
+
#define NEW_UNLESS(c,t,e) NEW_NODE(NODE_UNLESS,c,t,e)
|
372
|
+
#define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
|
373
|
+
#define NEW_CASE2(b) NEW_NODE(NODE_CASE2,0,b,0)
|
374
|
+
#define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
|
375
|
+
#define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
|
376
|
+
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
|
377
|
+
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
|
378
|
+
#define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
|
379
|
+
#define NEW_LAMBDA(a,b) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b),0)
|
380
|
+
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
|
381
|
+
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
|
382
|
+
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
|
383
|
+
#define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
|
384
|
+
#define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
|
385
|
+
#define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
|
386
|
+
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
|
387
|
+
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
|
388
|
+
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
|
389
|
+
#define NEW_YIELD(a) NEW_NODE(NODE_YIELD,a,0,0)
|
390
|
+
#define NEW_LIST(a) NEW_ARRAY(a)
|
391
|
+
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
|
392
|
+
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
|
393
|
+
#define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
|
394
|
+
#define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
|
395
|
+
#define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
|
396
|
+
#define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
|
397
|
+
#define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
|
398
|
+
#define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
|
399
|
+
#define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
|
400
|
+
#define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
|
401
|
+
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
|
402
|
+
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
|
403
|
+
#define NEW_OP_ASGN2(r,t,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o,t))
|
404
|
+
#define NEW_OP_ASGN22(i,o,t) NEW_NODE(NODE_OP_ASGN2,i,o,t)
|
405
|
+
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
|
406
|
+
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
|
407
|
+
#define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
|
408
|
+
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
|
409
|
+
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
|
410
|
+
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
|
411
|
+
#define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
|
412
|
+
#define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
|
413
|
+
#define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
|
414
|
+
#define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
|
415
|
+
#define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
|
416
|
+
#define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
|
417
|
+
#define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
|
418
|
+
#define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
|
419
|
+
#define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
|
420
|
+
#define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
|
421
|
+
#define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
|
422
|
+
#define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
|
423
|
+
#define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
|
424
|
+
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
|
425
|
+
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
|
426
|
+
#define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
|
427
|
+
#define NEW_OPCALL(r,m,a) NEW_NODE(NODE_OPCALL,r,m,a)
|
428
|
+
#define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
|
429
|
+
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
|
430
|
+
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
|
431
|
+
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
|
432
|
+
#define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
|
433
|
+
#define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
|
434
|
+
#define NEW_KW_ARG(i,v) NEW_NODE(NODE_KW_ARG,i,v,0)
|
435
|
+
#define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
|
436
|
+
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
|
437
|
+
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
|
438
|
+
#define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
|
439
|
+
#define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
|
440
|
+
#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
|
441
|
+
#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
|
442
|
+
#define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
|
443
|
+
#define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
|
444
|
+
#define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
|
445
|
+
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
|
446
|
+
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
|
447
|
+
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
|
448
|
+
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
|
449
|
+
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
|
450
|
+
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
|
451
|
+
#define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
|
452
|
+
#define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
|
453
|
+
#define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
|
454
|
+
#define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
|
455
|
+
#define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
|
456
|
+
#define NEW_PREEXE(b) NEW_SCOPE(b)
|
457
|
+
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
|
458
|
+
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
|
459
|
+
#define NEW_PRELUDE(p,b,o) NEW_NODE(NODE_PRELUDE,p,b,o)
|
460
|
+
|
461
|
+
#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
|
462
|
+
#define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
|
463
|
+
|
464
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
465
|
+
|
466
|
+
typedef struct node_buffer_struct node_buffer_t;
|
467
|
+
/* T_IMEMO/ast */
|
468
|
+
typedef struct rb_ast_struct {
|
469
|
+
VALUE flags;
|
470
|
+
VALUE reserved1;
|
471
|
+
NODE *root;
|
472
|
+
node_buffer_t *node_buffer;
|
473
|
+
VALUE mark_ary;
|
474
|
+
} rb_ast_t;
|
475
|
+
rb_ast_t *rb_ast_new();
|
476
|
+
void rb_ast_mark(rb_ast_t*);
|
477
|
+
void rb_ast_dispose(rb_ast_t*);
|
478
|
+
void rb_ast_free(rb_ast_t*);
|
479
|
+
void rb_ast_add_mark_object(rb_ast_t*, VALUE);
|
480
|
+
void rb_ast_delete_mark_object(rb_ast_t*, VALUE);
|
481
|
+
NODE *rb_ast_newnode(rb_ast_t*);
|
482
|
+
void rb_ast_delete_node(rb_ast_t*, NODE *n);
|
483
|
+
|
484
|
+
VALUE rb_parser_new(void);
|
485
|
+
VALUE rb_parser_end_seen_p(VALUE);
|
486
|
+
VALUE rb_parser_encoding(VALUE);
|
487
|
+
VALUE rb_parser_get_yydebug(VALUE);
|
488
|
+
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
489
|
+
VALUE rb_parser_dump_tree(NODE *node, int comment);
|
490
|
+
void rb_parser_set_options(VALUE, int, int, int, int);
|
491
|
+
|
492
|
+
rb_ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
|
493
|
+
rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
|
494
|
+
rb_ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int);
|
495
|
+
rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
|
496
|
+
rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
|
497
|
+
|
498
|
+
rb_ast_t *rb_compile_cstr(const char*, const char*, int, int);
|
499
|
+
rb_ast_t *rb_compile_string(const char*, VALUE, int);
|
500
|
+
rb_ast_t *rb_compile_file(const char*, VALUE, int);
|
501
|
+
|
502
|
+
void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
|
503
|
+
|
504
|
+
const struct kwtable *rb_reserved_word(const char *, unsigned int);
|
505
|
+
|
506
|
+
struct rb_args_info {
|
507
|
+
NODE *pre_init;
|
508
|
+
NODE *post_init;
|
509
|
+
|
510
|
+
int pre_args_num; /* count of mandatory pre-arguments */
|
511
|
+
int post_args_num; /* count of mandatory post-arguments */
|
512
|
+
|
513
|
+
ID first_post_arg;
|
514
|
+
|
515
|
+
ID rest_arg;
|
516
|
+
ID block_arg;
|
517
|
+
|
518
|
+
NODE *kw_args;
|
519
|
+
NODE *kw_rest_arg;
|
520
|
+
|
521
|
+
NODE *opt_args;
|
522
|
+
};
|
523
|
+
|
524
|
+
struct parser_params;
|
525
|
+
void *rb_parser_malloc(struct parser_params *, size_t);
|
526
|
+
void *rb_parser_realloc(struct parser_params *, void *, size_t);
|
527
|
+
void *rb_parser_calloc(struct parser_params *, size_t, size_t);
|
528
|
+
void rb_parser_free(struct parser_params *, void *);
|
529
|
+
void rb_parser_printf(struct parser_params *parser, const char *fmt, ...);
|
530
|
+
|
531
|
+
RUBY_SYMBOL_EXPORT_END
|
532
|
+
|
533
|
+
#if defined(__cplusplus)
|
534
|
+
#if 0
|
535
|
+
{ /* satisfy cc-mode */
|
536
|
+
#endif
|
537
|
+
} /* extern "C" { */
|
538
|
+
#endif
|
539
|
+
|
540
|
+
#endif /* RUBY_NODE_H */
|