did_you_mean 0.9.0 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +150 -0
- data/README.md +14 -1
- data/did_you_mean.gemspec +0 -1
- data/ext/did_you_mean/extconf.rb +14 -11
- data/ext/did_you_mean/ruby_headers/215/id.h +173 -0
- data/ext/did_you_mean/ruby_headers/215/internal.h +892 -0
- data/ext/did_you_mean/ruby_headers/215/method.h +142 -0
- data/ext/did_you_mean/ruby_headers/215/node.h +543 -0
- data/ext/did_you_mean/ruby_headers/215/ruby_atomic.h +170 -0
- data/ext/did_you_mean/ruby_headers/215/thread_native.h +23 -0
- data/ext/did_you_mean/ruby_headers/215/thread_pthread.h +56 -0
- data/ext/did_you_mean/ruby_headers/215/thread_win32.h +45 -0
- data/ext/did_you_mean/ruby_headers/215/vm_core.h +1055 -0
- data/ext/did_you_mean/ruby_headers/215/vm_debug.h +37 -0
- data/ext/did_you_mean/ruby_headers/215/vm_opts.h +56 -0
- data/ext/did_you_mean/ruby_headers/220/internal.h +11 -6
- data/ext/did_you_mean/ruby_headers/220/vm_core.h +1 -0
- data/lib/did_you_mean/finders.rb +1 -1
- data/lib/did_you_mean/test_helper.rb +0 -4
- data/lib/did_you_mean/version.rb +1 -1
- data/test/no_method_error_extension_test.rb +0 -6
- data/test/test_helper.rb +0 -1
- metadata +18 -196
- data/docs/did_you_mean_example.png +0 -0
- data/ext/did_you_mean/ruby_headers/193/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/193/constant.h +0 -34
- data/ext/did_you_mean/ruby_headers/193/dln.h +0 -50
- data/ext/did_you_mean/ruby_headers/193/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/193/eval_intern.h +0 -234
- data/ext/did_you_mean/ruby_headers/193/gc.h +0 -99
- data/ext/did_you_mean/ruby_headers/193/iseq.h +0 -126
- data/ext/did_you_mean/ruby_headers/193/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/193/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/193/regenc.h +0 -219
- data/ext/did_you_mean/ruby_headers/193/regint.h +0 -850
- data/ext/did_you_mean/ruby_headers/193/regparse.h +0 -362
- data/ext/did_you_mean/ruby_headers/193/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/193/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/193/timev.h +0 -21
- data/ext/did_you_mean/ruby_headers/193/transcode_data.h +0 -117
- data/ext/did_you_mean/ruby_headers/193/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/193/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/193/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/193/vm_exec.h +0 -184
- data/ext/did_you_mean/ruby_headers/193/vm_insnhelper.h +0 -220
- data/ext/did_you_mean/ruby_headers/200/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/200/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/200/dln.h +0 -50
- data/ext/did_you_mean/ruby_headers/200/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/200/eval_intern.h +0 -213
- data/ext/did_you_mean/ruby_headers/200/gc.h +0 -104
- data/ext/did_you_mean/ruby_headers/200/iseq.h +0 -140
- data/ext/did_you_mean/ruby_headers/200/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/200/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/200/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/200/regenc.h +0 -227
- data/ext/did_you_mean/ruby_headers/200/regint.h +0 -915
- data/ext/did_you_mean/ruby_headers/200/regparse.h +0 -367
- data/ext/did_you_mean/ruby_headers/200/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/200/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/200/timev.h +0 -21
- data/ext/did_you_mean/ruby_headers/200/transcode_data.h +0 -127
- data/ext/did_you_mean/ruby_headers/200/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/200/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/200/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/200/vm_exec.h +0 -173
- data/ext/did_you_mean/ruby_headers/200/vm_insnhelper.h +0 -274
- data/ext/did_you_mean/ruby_headers/210/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/210/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/210/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/210/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/210/eval_intern.h +0 -260
- data/ext/did_you_mean/ruby_headers/210/gc.h +0 -101
- data/ext/did_you_mean/ruby_headers/210/iseq.h +0 -136
- data/ext/did_you_mean/ruby_headers/210/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/210/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/210/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/210/regenc.h +0 -223
- data/ext/did_you_mean/ruby_headers/210/regint.h +0 -911
- data/ext/did_you_mean/ruby_headers/210/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/210/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/210/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/210/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/210/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/210/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/210/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/210/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/210/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/210/vm_insnhelper.h +0 -273
- data/ext/did_you_mean/ruby_headers/211/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/211/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/211/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/211/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/211/eval_intern.h +0 -260
- data/ext/did_you_mean/ruby_headers/211/gc.h +0 -101
- data/ext/did_you_mean/ruby_headers/211/iseq.h +0 -136
- data/ext/did_you_mean/ruby_headers/211/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/211/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/211/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/211/regenc.h +0 -223
- data/ext/did_you_mean/ruby_headers/211/regint.h +0 -911
- data/ext/did_you_mean/ruby_headers/211/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/211/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/211/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/211/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/211/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/211/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/211/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/211/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/211/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/211/vm_insnhelper.h +0 -273
- data/ext/did_you_mean/ruby_headers/212/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/212/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/212/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/212/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/212/eval_intern.h +0 -260
- data/ext/did_you_mean/ruby_headers/212/gc.h +0 -101
- data/ext/did_you_mean/ruby_headers/212/iseq.h +0 -136
- data/ext/did_you_mean/ruby_headers/212/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/212/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/212/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/212/regenc.h +0 -223
- data/ext/did_you_mean/ruby_headers/212/regint.h +0 -911
- data/ext/did_you_mean/ruby_headers/212/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/212/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/212/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/212/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/212/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/212/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/212/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/212/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/212/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/212/vm_insnhelper.h +0 -273
- data/ext/did_you_mean/ruby_headers/213/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/213/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/213/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/213/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/213/eval_intern.h +0 -270
- data/ext/did_you_mean/ruby_headers/213/gc.h +0 -101
- data/ext/did_you_mean/ruby_headers/213/iseq.h +0 -136
- data/ext/did_you_mean/ruby_headers/213/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/213/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/213/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/213/regenc.h +0 -223
- data/ext/did_you_mean/ruby_headers/213/regint.h +0 -911
- data/ext/did_you_mean/ruby_headers/213/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/213/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/213/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/213/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/213/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/213/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/213/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/213/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/213/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/213/vm_insnhelper.h +0 -273
- data/ext/did_you_mean/ruby_headers/214/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/214/constant.h +0 -36
- data/ext/did_you_mean/ruby_headers/214/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/214/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/214/eval_intern.h +0 -270
- data/ext/did_you_mean/ruby_headers/214/gc.h +0 -101
- data/ext/did_you_mean/ruby_headers/214/iseq.h +0 -136
- data/ext/did_you_mean/ruby_headers/214/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/214/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/214/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/214/regenc.h +0 -223
- data/ext/did_you_mean/ruby_headers/214/regint.h +0 -911
- data/ext/did_you_mean/ruby_headers/214/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/214/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/214/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/214/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/214/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/214/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/214/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/214/version.h +0 -52
- data/ext/did_you_mean/ruby_headers/214/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/214/vm_insnhelper.h +0 -273
- data/ext/did_you_mean/ruby_headers/220/addr2line.h +0 -21
- data/ext/did_you_mean/ruby_headers/220/ccan/build_assert/build_assert.h +0 -40
- data/ext/did_you_mean/ruby_headers/220/ccan/licenses/BSD-MIT +0 -17
- data/ext/did_you_mean/ruby_headers/220/ccan/licenses/CC0 +0 -28
- data/ext/did_you_mean/ruby_headers/220/constant.h +0 -43
- data/ext/did_you_mean/ruby_headers/220/dln.h +0 -51
- data/ext/did_you_mean/ruby_headers/220/encdb.h +0 -170
- data/ext/did_you_mean/ruby_headers/220/eval_intern.h +0 -275
- data/ext/did_you_mean/ruby_headers/220/gc.h +0 -107
- data/ext/did_you_mean/ruby_headers/220/iseq.h +0 -157
- data/ext/did_you_mean/ruby_headers/220/parse.h +0 -183
- data/ext/did_you_mean/ruby_headers/220/probes.h +0 -83
- data/ext/did_you_mean/ruby_headers/220/probes_helper.h +0 -67
- data/ext/did_you_mean/ruby_headers/220/regenc.h +0 -234
- data/ext/did_you_mean/ruby_headers/220/regint.h +0 -972
- data/ext/did_you_mean/ruby_headers/220/regparse.h +0 -363
- data/ext/did_you_mean/ruby_headers/220/revision.h +0 -1
- data/ext/did_you_mean/ruby_headers/220/siphash.h +0 -48
- data/ext/did_you_mean/ruby_headers/220/timev.h +0 -42
- data/ext/did_you_mean/ruby_headers/220/transcode_data.h +0 -123
- data/ext/did_you_mean/ruby_headers/220/transdb.h +0 -190
- data/ext/did_you_mean/ruby_headers/220/verconf.h +0 -13
- data/ext/did_you_mean/ruby_headers/220/version.h +0 -53
- data/ext/did_you_mean/ruby_headers/220/vm_exec.h +0 -182
- data/ext/did_you_mean/ruby_headers/220/vm_insnhelper.h +0 -233
@@ -0,0 +1,142 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
method.h -
|
4
|
+
|
5
|
+
$Author$
|
6
|
+
created at: Wed Jul 15 20:02:33 2009
|
7
|
+
|
8
|
+
Copyright (C) 2009 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
#ifndef METHOD_H
|
12
|
+
#define METHOD_H
|
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
|
+
typedef enum {
|
25
|
+
NOEX_PUBLIC = 0x00,
|
26
|
+
NOEX_NOSUPER = 0x01,
|
27
|
+
NOEX_PRIVATE = 0x02,
|
28
|
+
NOEX_PROTECTED = 0x04,
|
29
|
+
NOEX_MASK = 0x06,
|
30
|
+
NOEX_BASIC = 0x08,
|
31
|
+
NOEX_UNDEF = NOEX_NOSUPER,
|
32
|
+
NOEX_MODFUNC = 0x12,
|
33
|
+
NOEX_SUPER = 0x20,
|
34
|
+
NOEX_VCALL = 0x40,
|
35
|
+
NOEX_RESPONDS = 0x80,
|
36
|
+
|
37
|
+
NOEX_BIT_WIDTH = 8,
|
38
|
+
NOEX_SAFE_SHIFT_OFFSET = ((NOEX_BIT_WIDTH+3)/4)*4 /* round up to nibble */
|
39
|
+
} rb_method_flag_t;
|
40
|
+
|
41
|
+
#define NOEX_SAFE(n) ((int)((n) >> NOEX_SAFE_SHIFT_OFFSET) & 0x0F)
|
42
|
+
#define NOEX_WITH(n, s) (((s) << NOEX_SAFE_SHIFT_OFFSET) | (n) | (ruby_running ? 0 : NOEX_BASIC))
|
43
|
+
#define NOEX_WITH_SAFE(n) NOEX_WITH((n), rb_safe_level())
|
44
|
+
|
45
|
+
/* method data type */
|
46
|
+
|
47
|
+
typedef enum {
|
48
|
+
VM_METHOD_TYPE_ISEQ,
|
49
|
+
VM_METHOD_TYPE_CFUNC,
|
50
|
+
VM_METHOD_TYPE_ATTRSET,
|
51
|
+
VM_METHOD_TYPE_IVAR,
|
52
|
+
VM_METHOD_TYPE_BMETHOD,
|
53
|
+
VM_METHOD_TYPE_ZSUPER,
|
54
|
+
VM_METHOD_TYPE_UNDEF,
|
55
|
+
VM_METHOD_TYPE_NOTIMPLEMENTED,
|
56
|
+
VM_METHOD_TYPE_OPTIMIZED, /* Kernel#send, Proc#call, etc */
|
57
|
+
VM_METHOD_TYPE_MISSING, /* wrapper for method_missing(id) */
|
58
|
+
VM_METHOD_TYPE_REFINED,
|
59
|
+
|
60
|
+
END_OF_ENUMERATION(VM_METHOD_TYPE)
|
61
|
+
} rb_method_type_t;
|
62
|
+
|
63
|
+
struct rb_call_info_struct;
|
64
|
+
|
65
|
+
typedef struct rb_method_cfunc_struct {
|
66
|
+
VALUE (*func)(ANYARGS);
|
67
|
+
VALUE (*invoker)(VALUE (*func)(ANYARGS), VALUE recv, int argc, const VALUE *argv);
|
68
|
+
int argc;
|
69
|
+
} rb_method_cfunc_t;
|
70
|
+
|
71
|
+
typedef struct rb_method_attr_struct {
|
72
|
+
ID id;
|
73
|
+
const VALUE location;
|
74
|
+
} rb_method_attr_t;
|
75
|
+
|
76
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
77
|
+
|
78
|
+
typedef struct rb_method_definition_struct {
|
79
|
+
rb_method_type_t type; /* method type */
|
80
|
+
ID original_id;
|
81
|
+
union {
|
82
|
+
rb_iseq_t * const iseq; /* should be mark */
|
83
|
+
rb_method_cfunc_t cfunc;
|
84
|
+
rb_method_attr_t attr;
|
85
|
+
const VALUE proc; /* should be mark */
|
86
|
+
enum method_optimized_type {
|
87
|
+
OPTIMIZED_METHOD_TYPE_SEND,
|
88
|
+
OPTIMIZED_METHOD_TYPE_CALL,
|
89
|
+
|
90
|
+
OPTIMIZED_METHOD_TYPE__MAX
|
91
|
+
} optimize_type;
|
92
|
+
struct rb_method_entry_struct *orig_me;
|
93
|
+
} body;
|
94
|
+
int alias_count;
|
95
|
+
} rb_method_definition_t;
|
96
|
+
|
97
|
+
typedef struct rb_method_entry_struct {
|
98
|
+
rb_method_flag_t flag;
|
99
|
+
char mark;
|
100
|
+
rb_method_definition_t *def;
|
101
|
+
ID called_id;
|
102
|
+
VALUE klass; /* should be mark */
|
103
|
+
} rb_method_entry_t;
|
104
|
+
|
105
|
+
struct unlinked_method_entry_list_entry {
|
106
|
+
struct unlinked_method_entry_list_entry *next;
|
107
|
+
rb_method_entry_t *me;
|
108
|
+
};
|
109
|
+
|
110
|
+
#define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
|
111
|
+
|
112
|
+
void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
|
113
|
+
rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
|
114
|
+
rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr);
|
115
|
+
rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);
|
116
|
+
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
|
117
|
+
rb_method_entry_t *rb_resolve_refined_method(VALUE refinements,
|
118
|
+
const rb_method_entry_t *me,
|
119
|
+
VALUE *defined_class_ptr);
|
120
|
+
rb_method_entry_t *rb_method_entry_with_refinements(VALUE klass, ID id,
|
121
|
+
VALUE *defined_class_ptr);
|
122
|
+
rb_method_entry_t *rb_method_entry_without_refinements(VALUE klass, ID id,
|
123
|
+
VALUE *defined_class_ptr);
|
124
|
+
|
125
|
+
rb_method_entry_t *rb_method_entry_get_without_cache(VALUE klass, ID id, VALUE *define_class_ptr);
|
126
|
+
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_flag_t noex);
|
127
|
+
|
128
|
+
int rb_method_entry_arity(const rb_method_entry_t *me);
|
129
|
+
int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2);
|
130
|
+
st_index_t rb_hash_method_entry(st_index_t hash, const rb_method_entry_t *me);
|
131
|
+
|
132
|
+
VALUE rb_method_entry_location(rb_method_entry_t *me);
|
133
|
+
VALUE rb_mod_method_location(VALUE mod, ID id);
|
134
|
+
VALUE rb_obj_method_location(VALUE obj, ID id);
|
135
|
+
|
136
|
+
void rb_mark_method_entry(const rb_method_entry_t *me);
|
137
|
+
void rb_free_method_entry(rb_method_entry_t *me);
|
138
|
+
void rb_sweep_method_entry(void *vm);
|
139
|
+
void rb_free_m_tbl(st_table *tbl);
|
140
|
+
void rb_free_m_tbl_wrapper(struct method_table_wrapper *wrapper);
|
141
|
+
|
142
|
+
#endif /* METHOD_H */
|
@@ -0,0 +1,543 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
node.h -
|
4
|
+
|
5
|
+
$Author$
|
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_CASE,
|
30
|
+
#define NODE_CASE NODE_CASE
|
31
|
+
NODE_WHEN,
|
32
|
+
#define NODE_WHEN NODE_WHEN
|
33
|
+
NODE_OPT_N,
|
34
|
+
#define NODE_OPT_N NODE_OPT_N
|
35
|
+
NODE_WHILE,
|
36
|
+
#define NODE_WHILE NODE_WHILE
|
37
|
+
NODE_UNTIL,
|
38
|
+
#define NODE_UNTIL NODE_UNTIL
|
39
|
+
NODE_ITER,
|
40
|
+
#define NODE_ITER NODE_ITER
|
41
|
+
NODE_FOR,
|
42
|
+
#define NODE_FOR NODE_FOR
|
43
|
+
NODE_BREAK,
|
44
|
+
#define NODE_BREAK NODE_BREAK
|
45
|
+
NODE_NEXT,
|
46
|
+
#define NODE_NEXT NODE_NEXT
|
47
|
+
NODE_REDO,
|
48
|
+
#define NODE_REDO NODE_REDO
|
49
|
+
NODE_RETRY,
|
50
|
+
#define NODE_RETRY NODE_RETRY
|
51
|
+
NODE_BEGIN,
|
52
|
+
#define NODE_BEGIN NODE_BEGIN
|
53
|
+
NODE_RESCUE,
|
54
|
+
#define NODE_RESCUE NODE_RESCUE
|
55
|
+
NODE_RESBODY,
|
56
|
+
#define NODE_RESBODY NODE_RESBODY
|
57
|
+
NODE_ENSURE,
|
58
|
+
#define NODE_ENSURE NODE_ENSURE
|
59
|
+
NODE_AND,
|
60
|
+
#define NODE_AND NODE_AND
|
61
|
+
NODE_OR,
|
62
|
+
#define NODE_OR NODE_OR
|
63
|
+
NODE_MASGN,
|
64
|
+
#define NODE_MASGN NODE_MASGN
|
65
|
+
NODE_LASGN,
|
66
|
+
#define NODE_LASGN NODE_LASGN
|
67
|
+
NODE_DASGN,
|
68
|
+
#define NODE_DASGN NODE_DASGN
|
69
|
+
NODE_DASGN_CURR,
|
70
|
+
#define NODE_DASGN_CURR NODE_DASGN_CURR
|
71
|
+
NODE_GASGN,
|
72
|
+
#define NODE_GASGN NODE_GASGN
|
73
|
+
NODE_IASGN,
|
74
|
+
#define NODE_IASGN NODE_IASGN
|
75
|
+
NODE_IASGN2,
|
76
|
+
#define NODE_IASGN2 NODE_IASGN2
|
77
|
+
NODE_CDECL,
|
78
|
+
#define NODE_CDECL NODE_CDECL
|
79
|
+
NODE_CVASGN,
|
80
|
+
#define NODE_CVASGN NODE_CVASGN
|
81
|
+
NODE_CVDECL,
|
82
|
+
#define NODE_CVDECL NODE_CVDECL
|
83
|
+
NODE_OP_ASGN1,
|
84
|
+
#define NODE_OP_ASGN1 NODE_OP_ASGN1
|
85
|
+
NODE_OP_ASGN2,
|
86
|
+
#define NODE_OP_ASGN2 NODE_OP_ASGN2
|
87
|
+
NODE_OP_ASGN_AND,
|
88
|
+
#define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
|
89
|
+
NODE_OP_ASGN_OR,
|
90
|
+
#define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
|
91
|
+
NODE_OP_CDECL,
|
92
|
+
#define NODE_OP_CDECL NODE_OP_CDECL
|
93
|
+
NODE_CALL,
|
94
|
+
#define NODE_CALL NODE_CALL
|
95
|
+
NODE_FCALL,
|
96
|
+
#define NODE_FCALL NODE_FCALL
|
97
|
+
NODE_VCALL,
|
98
|
+
#define NODE_VCALL NODE_VCALL
|
99
|
+
NODE_SUPER,
|
100
|
+
#define NODE_SUPER NODE_SUPER
|
101
|
+
NODE_ZSUPER,
|
102
|
+
#define NODE_ZSUPER NODE_ZSUPER
|
103
|
+
NODE_ARRAY,
|
104
|
+
#define NODE_ARRAY NODE_ARRAY
|
105
|
+
NODE_ZARRAY,
|
106
|
+
#define NODE_ZARRAY NODE_ZARRAY
|
107
|
+
NODE_VALUES,
|
108
|
+
#define NODE_VALUES NODE_VALUES
|
109
|
+
NODE_HASH,
|
110
|
+
#define NODE_HASH NODE_HASH
|
111
|
+
NODE_RETURN,
|
112
|
+
#define NODE_RETURN NODE_RETURN
|
113
|
+
NODE_YIELD,
|
114
|
+
#define NODE_YIELD NODE_YIELD
|
115
|
+
NODE_LVAR,
|
116
|
+
#define NODE_LVAR NODE_LVAR
|
117
|
+
NODE_DVAR,
|
118
|
+
#define NODE_DVAR NODE_DVAR
|
119
|
+
NODE_GVAR,
|
120
|
+
#define NODE_GVAR NODE_GVAR
|
121
|
+
NODE_IVAR,
|
122
|
+
#define NODE_IVAR NODE_IVAR
|
123
|
+
NODE_CONST,
|
124
|
+
#define NODE_CONST NODE_CONST
|
125
|
+
NODE_CVAR,
|
126
|
+
#define NODE_CVAR NODE_CVAR
|
127
|
+
NODE_NTH_REF,
|
128
|
+
#define NODE_NTH_REF NODE_NTH_REF
|
129
|
+
NODE_BACK_REF,
|
130
|
+
#define NODE_BACK_REF NODE_BACK_REF
|
131
|
+
NODE_MATCH,
|
132
|
+
#define NODE_MATCH NODE_MATCH
|
133
|
+
NODE_MATCH2,
|
134
|
+
#define NODE_MATCH2 NODE_MATCH2
|
135
|
+
NODE_MATCH3,
|
136
|
+
#define NODE_MATCH3 NODE_MATCH3
|
137
|
+
NODE_LIT,
|
138
|
+
#define NODE_LIT NODE_LIT
|
139
|
+
NODE_STR,
|
140
|
+
#define NODE_STR NODE_STR
|
141
|
+
NODE_DSTR,
|
142
|
+
#define NODE_DSTR NODE_DSTR
|
143
|
+
NODE_XSTR,
|
144
|
+
#define NODE_XSTR NODE_XSTR
|
145
|
+
NODE_DXSTR,
|
146
|
+
#define NODE_DXSTR NODE_DXSTR
|
147
|
+
NODE_EVSTR,
|
148
|
+
#define NODE_EVSTR NODE_EVSTR
|
149
|
+
NODE_DREGX,
|
150
|
+
#define NODE_DREGX NODE_DREGX
|
151
|
+
NODE_DREGX_ONCE,
|
152
|
+
#define NODE_DREGX_ONCE NODE_DREGX_ONCE
|
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_TO_ARY,
|
170
|
+
#define NODE_TO_ARY NODE_TO_ARY
|
171
|
+
NODE_BLOCK_ARG,
|
172
|
+
#define NODE_BLOCK_ARG NODE_BLOCK_ARG
|
173
|
+
NODE_BLOCK_PASS,
|
174
|
+
#define NODE_BLOCK_PASS NODE_BLOCK_PASS
|
175
|
+
NODE_DEFN,
|
176
|
+
#define NODE_DEFN NODE_DEFN
|
177
|
+
NODE_DEFS,
|
178
|
+
#define NODE_DEFS NODE_DEFS
|
179
|
+
NODE_ALIAS,
|
180
|
+
#define NODE_ALIAS NODE_ALIAS
|
181
|
+
NODE_VALIAS,
|
182
|
+
#define NODE_VALIAS NODE_VALIAS
|
183
|
+
NODE_UNDEF,
|
184
|
+
#define NODE_UNDEF NODE_UNDEF
|
185
|
+
NODE_CLASS,
|
186
|
+
#define NODE_CLASS NODE_CLASS
|
187
|
+
NODE_MODULE,
|
188
|
+
#define NODE_MODULE NODE_MODULE
|
189
|
+
NODE_SCLASS,
|
190
|
+
#define NODE_SCLASS NODE_SCLASS
|
191
|
+
NODE_COLON2,
|
192
|
+
#define NODE_COLON2 NODE_COLON2
|
193
|
+
NODE_COLON3,
|
194
|
+
#define NODE_COLON3 NODE_COLON3
|
195
|
+
NODE_CREF,
|
196
|
+
#define NODE_CREF NODE_CREF
|
197
|
+
NODE_DOT2,
|
198
|
+
#define NODE_DOT2 NODE_DOT2
|
199
|
+
NODE_DOT3,
|
200
|
+
#define NODE_DOT3 NODE_DOT3
|
201
|
+
NODE_FLIP2,
|
202
|
+
#define NODE_FLIP2 NODE_FLIP2
|
203
|
+
NODE_FLIP3,
|
204
|
+
#define NODE_FLIP3 NODE_FLIP3
|
205
|
+
NODE_SELF,
|
206
|
+
#define NODE_SELF NODE_SELF
|
207
|
+
NODE_NIL,
|
208
|
+
#define NODE_NIL NODE_NIL
|
209
|
+
NODE_TRUE,
|
210
|
+
#define NODE_TRUE NODE_TRUE
|
211
|
+
NODE_FALSE,
|
212
|
+
#define NODE_FALSE NODE_FALSE
|
213
|
+
NODE_ERRINFO,
|
214
|
+
#define NODE_ERRINFO NODE_ERRINFO
|
215
|
+
NODE_DEFINED,
|
216
|
+
#define NODE_DEFINED NODE_DEFINED
|
217
|
+
NODE_POSTEXE,
|
218
|
+
#define NODE_POSTEXE NODE_POSTEXE
|
219
|
+
NODE_ALLOCA,
|
220
|
+
#define NODE_ALLOCA NODE_ALLOCA
|
221
|
+
NODE_BMETHOD,
|
222
|
+
#define NODE_BMETHOD NODE_BMETHOD
|
223
|
+
NODE_MEMO,
|
224
|
+
#define NODE_MEMO NODE_MEMO
|
225
|
+
NODE_IFUNC,
|
226
|
+
#define NODE_IFUNC NODE_IFUNC
|
227
|
+
NODE_DSYM,
|
228
|
+
#define NODE_DSYM NODE_DSYM
|
229
|
+
NODE_ATTRASGN,
|
230
|
+
#define NODE_ATTRASGN NODE_ATTRASGN
|
231
|
+
NODE_PRELUDE,
|
232
|
+
#define NODE_PRELUDE NODE_PRELUDE
|
233
|
+
NODE_LAMBDA,
|
234
|
+
#define NODE_LAMBDA NODE_LAMBDA
|
235
|
+
NODE_LAST
|
236
|
+
#define NODE_LAST NODE_LAST
|
237
|
+
};
|
238
|
+
|
239
|
+
typedef struct RNode {
|
240
|
+
VALUE flags;
|
241
|
+
VALUE nd_reserved; /* ex nd_file */
|
242
|
+
union {
|
243
|
+
struct RNode *node;
|
244
|
+
ID id;
|
245
|
+
VALUE value;
|
246
|
+
VALUE (*cfunc)(ANYARGS);
|
247
|
+
ID *tbl;
|
248
|
+
} u1;
|
249
|
+
union {
|
250
|
+
struct RNode *node;
|
251
|
+
ID id;
|
252
|
+
long argc;
|
253
|
+
VALUE value;
|
254
|
+
} u2;
|
255
|
+
union {
|
256
|
+
struct RNode *node;
|
257
|
+
ID id;
|
258
|
+
long state;
|
259
|
+
struct rb_global_entry *entry;
|
260
|
+
struct rb_args_info *args;
|
261
|
+
long cnt;
|
262
|
+
VALUE value;
|
263
|
+
} u3;
|
264
|
+
} NODE;
|
265
|
+
|
266
|
+
#define RNODE(obj) (R_CAST(RNode)(obj))
|
267
|
+
|
268
|
+
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTERD, 10: EXIVAR, 11: FREEZE */
|
269
|
+
/* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE|NODE_FL_CREF_PUSHED_BY_EVAL,
|
270
|
+
* 8..14: nd_type,
|
271
|
+
* 15..: nd_line or
|
272
|
+
* 15: NODE_FL_CREF_PUSHED_BY_EVAL
|
273
|
+
* 16: NODE_FL_CREF_OMOD_SHARED
|
274
|
+
*/
|
275
|
+
#define NODE_FL_NEWLINE (((VALUE)1)<<7)
|
276
|
+
#define NODE_FL_CREF_PUSHED_BY_EVAL (((VALUE)1)<<15)
|
277
|
+
#define NODE_FL_CREF_OMOD_SHARED (((VALUE)1)<<16)
|
278
|
+
|
279
|
+
#define NODE_TYPESHIFT 8
|
280
|
+
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
|
281
|
+
|
282
|
+
#define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
|
283
|
+
#define nd_set_type(n,t) \
|
284
|
+
RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
|
285
|
+
|
286
|
+
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
|
287
|
+
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
|
288
|
+
#define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
|
289
|
+
#define nd_set_line(n,l) \
|
290
|
+
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
|
291
|
+
|
292
|
+
#define nd_refinements nd_reserved
|
293
|
+
|
294
|
+
#define nd_head u1.node
|
295
|
+
#define nd_alen u2.argc
|
296
|
+
#define nd_next u3.node
|
297
|
+
|
298
|
+
#define nd_cond u1.node
|
299
|
+
#define nd_body u2.node
|
300
|
+
#define nd_else u3.node
|
301
|
+
|
302
|
+
#define nd_orig u3.value
|
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_modl u1.id
|
350
|
+
#define nd_clss u1.value
|
351
|
+
|
352
|
+
#define nd_beg u1.node
|
353
|
+
#define nd_end u2.node
|
354
|
+
#define nd_state u3.state
|
355
|
+
#define nd_rval u2.value
|
356
|
+
|
357
|
+
#define nd_nth u2.argc
|
358
|
+
|
359
|
+
#define nd_tag u1.id
|
360
|
+
#define nd_tval u2.value
|
361
|
+
|
362
|
+
#define nd_visi u2.argc
|
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_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
|
369
|
+
#define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
|
370
|
+
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
|
371
|
+
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
|
372
|
+
#define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
|
373
|
+
#define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
|
374
|
+
#define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
|
375
|
+
#define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
|
376
|
+
#define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
|
377
|
+
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
|
378
|
+
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
|
379
|
+
#define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
|
380
|
+
#define NEW_LAMBDA(a,b) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b),0)
|
381
|
+
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
|
382
|
+
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
|
383
|
+
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
|
384
|
+
#define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
|
385
|
+
#define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
|
386
|
+
#define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
|
387
|
+
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
|
388
|
+
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
|
389
|
+
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
|
390
|
+
#define NEW_YIELD(a) NEW_NODE(NODE_YIELD,a,0,0)
|
391
|
+
#define NEW_LIST(a) NEW_ARRAY(a)
|
392
|
+
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
|
393
|
+
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
|
394
|
+
#define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
|
395
|
+
#define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
|
396
|
+
#define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
|
397
|
+
#define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
|
398
|
+
#define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
|
399
|
+
#define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
|
400
|
+
#define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
|
401
|
+
#define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
|
402
|
+
#define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
|
403
|
+
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
|
404
|
+
#define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
|
405
|
+
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
|
406
|
+
#define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
|
407
|
+
#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
|
408
|
+
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
|
409
|
+
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
|
410
|
+
#define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
|
411
|
+
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
|
412
|
+
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
|
413
|
+
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
|
414
|
+
#define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
|
415
|
+
#define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
|
416
|
+
#define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
|
417
|
+
#define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
|
418
|
+
#define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
|
419
|
+
#define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
|
420
|
+
#define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
|
421
|
+
#define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
|
422
|
+
#define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
|
423
|
+
#define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
|
424
|
+
#define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
|
425
|
+
#define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
|
426
|
+
#define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
|
427
|
+
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
|
428
|
+
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
|
429
|
+
#define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
|
430
|
+
#define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
|
431
|
+
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
|
432
|
+
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
|
433
|
+
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
|
434
|
+
#define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
|
435
|
+
#define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
|
436
|
+
#define NEW_KW_ARG(i,v) NEW_NODE(NODE_KW_ARG,i,v,0)
|
437
|
+
#define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
|
438
|
+
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
|
439
|
+
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
|
440
|
+
#define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
|
441
|
+
#define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
|
442
|
+
#define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
|
443
|
+
#define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
|
444
|
+
#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
|
445
|
+
#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
|
446
|
+
#define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
|
447
|
+
#define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
|
448
|
+
#define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
|
449
|
+
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
|
450
|
+
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
|
451
|
+
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
|
452
|
+
#define NEW_CREF(a) NEW_NODE(NODE_CREF,a,0,0)
|
453
|
+
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
|
454
|
+
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
|
455
|
+
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
|
456
|
+
#define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
|
457
|
+
#define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
|
458
|
+
#define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
|
459
|
+
#define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
|
460
|
+
#define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
|
461
|
+
#define NEW_PREEXE(b) NEW_SCOPE(b)
|
462
|
+
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
|
463
|
+
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
|
464
|
+
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
|
465
|
+
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
|
466
|
+
#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
|
467
|
+
|
468
|
+
#define roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y))
|
469
|
+
#define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
|
470
|
+
#define NEW_MEMO_FOR(type, value) \
|
471
|
+
(rb_ary_set_len(((value) = rb_ary_tmp_new(roomof(type, VALUE))), \
|
472
|
+
roomof(type, VALUE)), \
|
473
|
+
MEMO_FOR(type, value))
|
474
|
+
|
475
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
476
|
+
|
477
|
+
VALUE rb_parser_new(void);
|
478
|
+
VALUE rb_parser_end_seen_p(VALUE);
|
479
|
+
VALUE rb_parser_encoding(VALUE);
|
480
|
+
VALUE rb_parser_get_yydebug(VALUE);
|
481
|
+
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
482
|
+
VALUE rb_parser_dump_tree(NODE *node, int comment);
|
483
|
+
NODE *rb_parser_append_print(VALUE, NODE *);
|
484
|
+
NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
|
485
|
+
|
486
|
+
NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
|
487
|
+
NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
|
488
|
+
NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
|
489
|
+
NODE *rb_parser_compile_string_path(volatile VALUE vparser, VALUE fname, VALUE src, int line);
|
490
|
+
NODE *rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE input, int line);
|
491
|
+
|
492
|
+
NODE *rb_compile_cstr(const char*, const char*, int, int);
|
493
|
+
NODE *rb_compile_string(const char*, VALUE, int);
|
494
|
+
NODE *rb_compile_file(const char*, VALUE, int);
|
495
|
+
|
496
|
+
NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
|
497
|
+
NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
|
498
|
+
|
499
|
+
struct rb_global_entry {
|
500
|
+
struct rb_global_variable *var;
|
501
|
+
ID id;
|
502
|
+
};
|
503
|
+
|
504
|
+
struct rb_global_entry *rb_global_entry(ID);
|
505
|
+
VALUE rb_gvar_get(struct rb_global_entry *);
|
506
|
+
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
507
|
+
VALUE rb_gvar_defined(struct rb_global_entry *);
|
508
|
+
const struct kwtable *rb_reserved_word(const char *, unsigned int);
|
509
|
+
|
510
|
+
struct rb_args_info {
|
511
|
+
NODE *pre_init;
|
512
|
+
NODE *post_init;
|
513
|
+
|
514
|
+
int pre_args_num; /* count of mandatory pre-arguments */
|
515
|
+
int post_args_num; /* count of mandatory post-arguments */
|
516
|
+
|
517
|
+
ID first_post_arg;
|
518
|
+
|
519
|
+
ID rest_arg;
|
520
|
+
ID block_arg;
|
521
|
+
|
522
|
+
NODE *kw_args;
|
523
|
+
NODE *kw_rest_arg;
|
524
|
+
|
525
|
+
NODE *opt_args;
|
526
|
+
};
|
527
|
+
|
528
|
+
struct parser_params;
|
529
|
+
void *rb_parser_malloc(struct parser_params *, size_t);
|
530
|
+
void *rb_parser_realloc(struct parser_params *, void *, size_t);
|
531
|
+
void *rb_parser_calloc(struct parser_params *, size_t, size_t);
|
532
|
+
void rb_parser_free(struct parser_params *, void *);
|
533
|
+
|
534
|
+
RUBY_SYMBOL_EXPORT_END
|
535
|
+
|
536
|
+
#if defined(__cplusplus)
|
537
|
+
#if 0
|
538
|
+
{ /* satisfy cc-mode */
|
539
|
+
#endif
|
540
|
+
} /* extern "C" { */
|
541
|
+
#endif
|
542
|
+
|
543
|
+
#endif /* RUBY_NODE_H */
|