nodewrap 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/COPYING +59 -0
  2. data/LEGAL +6 -0
  3. data/LGPL +515 -0
  4. data/LICENSE +6 -0
  5. data/README +31 -0
  6. data/TODO +9 -0
  7. data/example/README +5 -0
  8. data/example/simple_client.rb +12 -0
  9. data/example/simple_server.rb +11 -0
  10. data/example/triangle_client.rb +7 -0
  11. data/example/triangle_server.rb +24 -0
  12. data/ext/MANIFEST +11 -0
  13. data/ext/builtins.h +25 -0
  14. data/ext/cached/ruby-1.6.3/COPYING +340 -0
  15. data/ext/cached/ruby-1.6.3/README +3 -0
  16. data/ext/cached/ruby-1.6.3/classpath.c +3 -0
  17. data/ext/cached/ruby-1.6.3/classpath.h +8 -0
  18. data/ext/cached/ruby-1.6.3/evalinfo.h +62 -0
  19. data/ext/cached/ruby-1.6.3/global_entry.h +15 -0
  20. data/ext/cached/ruby-1.6.3/insns_info.c +40 -0
  21. data/ext/cached/ruby-1.6.3/insns_info.h +19 -0
  22. data/ext/cached/ruby-1.6.3/node_type_descrip.c +150 -0
  23. data/ext/cached/ruby-1.6.3/nodeinfo.c +3182 -0
  24. data/ext/cached/ruby-1.6.3/nodeinfo.h +66 -0
  25. data/ext/cached/ruby-1.6.4/COPYING +340 -0
  26. data/ext/cached/ruby-1.6.4/README +3 -0
  27. data/ext/cached/ruby-1.6.4/classpath.c +3 -0
  28. data/ext/cached/ruby-1.6.4/classpath.h +8 -0
  29. data/ext/cached/ruby-1.6.4/evalinfo.h +62 -0
  30. data/ext/cached/ruby-1.6.4/global_entry.h +15 -0
  31. data/ext/cached/ruby-1.6.4/insns_info.c +40 -0
  32. data/ext/cached/ruby-1.6.4/insns_info.h +19 -0
  33. data/ext/cached/ruby-1.6.4/node_type_descrip.c +150 -0
  34. data/ext/cached/ruby-1.6.4/nodeinfo.c +3182 -0
  35. data/ext/cached/ruby-1.6.4/nodeinfo.h +66 -0
  36. data/ext/cached/ruby-1.6.5/COPYING +56 -0
  37. data/ext/cached/ruby-1.6.5/GPL +340 -0
  38. data/ext/cached/ruby-1.6.5/LEGAL +325 -0
  39. data/ext/cached/ruby-1.6.5/LGPL +504 -0
  40. data/ext/cached/ruby-1.6.5/README +3 -0
  41. data/ext/cached/ruby-1.6.5/classpath.c +3 -0
  42. data/ext/cached/ruby-1.6.5/classpath.h +8 -0
  43. data/ext/cached/ruby-1.6.5/evalinfo.h +63 -0
  44. data/ext/cached/ruby-1.6.5/global_entry.h +15 -0
  45. data/ext/cached/ruby-1.6.5/insns_info.c +40 -0
  46. data/ext/cached/ruby-1.6.5/insns_info.h +19 -0
  47. data/ext/cached/ruby-1.6.5/node_type_descrip.c +150 -0
  48. data/ext/cached/ruby-1.6.5/nodeinfo.c +3182 -0
  49. data/ext/cached/ruby-1.6.5/nodeinfo.h +66 -0
  50. data/ext/cached/ruby-1.6.7/COPYING +56 -0
  51. data/ext/cached/ruby-1.6.7/GPL +340 -0
  52. data/ext/cached/ruby-1.6.7/LEGAL +308 -0
  53. data/ext/cached/ruby-1.6.7/LGPL +504 -0
  54. data/ext/cached/ruby-1.6.7/README +3 -0
  55. data/ext/cached/ruby-1.6.7/classpath.c +3 -0
  56. data/ext/cached/ruby-1.6.7/classpath.h +8 -0
  57. data/ext/cached/ruby-1.6.7/evalinfo.h +63 -0
  58. data/ext/cached/ruby-1.6.7/global_entry.h +15 -0
  59. data/ext/cached/ruby-1.6.7/insns_info.c +40 -0
  60. data/ext/cached/ruby-1.6.7/insns_info.h +19 -0
  61. data/ext/cached/ruby-1.6.7/node_type_descrip.c +150 -0
  62. data/ext/cached/ruby-1.6.7/nodeinfo.c +3182 -0
  63. data/ext/cached/ruby-1.6.7/nodeinfo.h +66 -0
  64. data/ext/cached/ruby-1.6.8/COPYING +56 -0
  65. data/ext/cached/ruby-1.6.8/GPL +340 -0
  66. data/ext/cached/ruby-1.6.8/LEGAL +308 -0
  67. data/ext/cached/ruby-1.6.8/LGPL +504 -0
  68. data/ext/cached/ruby-1.6.8/README +3 -0
  69. data/ext/cached/ruby-1.6.8/classpath.c +3 -0
  70. data/ext/cached/ruby-1.6.8/classpath.h +8 -0
  71. data/ext/cached/ruby-1.6.8/evalinfo.h +63 -0
  72. data/ext/cached/ruby-1.6.8/global_entry.h +15 -0
  73. data/ext/cached/ruby-1.6.8/insns_info.c +40 -0
  74. data/ext/cached/ruby-1.6.8/insns_info.h +19 -0
  75. data/ext/cached/ruby-1.6.8/node_type_descrip.c +150 -0
  76. data/ext/cached/ruby-1.6.8/nodeinfo.c +3182 -0
  77. data/ext/cached/ruby-1.6.8/nodeinfo.h +66 -0
  78. data/ext/cached/ruby-1.8.0/COPYING +56 -0
  79. data/ext/cached/ruby-1.8.0/GPL +340 -0
  80. data/ext/cached/ruby-1.8.0/LEGAL +371 -0
  81. data/ext/cached/ruby-1.8.0/LGPL +504 -0
  82. data/ext/cached/ruby-1.8.0/README +3 -0
  83. data/ext/cached/ruby-1.8.0/classpath.c +27 -0
  84. data/ext/cached/ruby-1.8.0/classpath.h +14 -0
  85. data/ext/cached/ruby-1.8.0/evalinfo.h +65 -0
  86. data/ext/cached/ruby-1.8.0/global_entry.h +10 -0
  87. data/ext/cached/ruby-1.8.0/insns_info.c +40 -0
  88. data/ext/cached/ruby-1.8.0/insns_info.h +19 -0
  89. data/ext/cached/ruby-1.8.0/node_type_descrip.c +150 -0
  90. data/ext/cached/ruby-1.8.0/nodeinfo.c +3199 -0
  91. data/ext/cached/ruby-1.8.0/nodeinfo.h +66 -0
  92. data/ext/cached/ruby-1.8.1/COPYING +56 -0
  93. data/ext/cached/ruby-1.8.1/GPL +340 -0
  94. data/ext/cached/ruby-1.8.1/LEGAL +371 -0
  95. data/ext/cached/ruby-1.8.1/LGPL +504 -0
  96. data/ext/cached/ruby-1.8.1/README +3 -0
  97. data/ext/cached/ruby-1.8.1/classpath.c +27 -0
  98. data/ext/cached/ruby-1.8.1/classpath.h +14 -0
  99. data/ext/cached/ruby-1.8.1/evalinfo.h +59 -0
  100. data/ext/cached/ruby-1.8.1/global_entry.h +10 -0
  101. data/ext/cached/ruby-1.8.1/insns_info.c +40 -0
  102. data/ext/cached/ruby-1.8.1/insns_info.h +19 -0
  103. data/ext/cached/ruby-1.8.1/node_type_descrip.c +150 -0
  104. data/ext/cached/ruby-1.8.1/nodeinfo.c +3199 -0
  105. data/ext/cached/ruby-1.8.1/nodeinfo.h +66 -0
  106. data/ext/cached/ruby-1.8.2/COPYING +56 -0
  107. data/ext/cached/ruby-1.8.2/GPL +340 -0
  108. data/ext/cached/ruby-1.8.2/LEGAL +371 -0
  109. data/ext/cached/ruby-1.8.2/LGPL +504 -0
  110. data/ext/cached/ruby-1.8.2/README +3 -0
  111. data/ext/cached/ruby-1.8.2/classpath.c +45 -0
  112. data/ext/cached/ruby-1.8.2/classpath.h +17 -0
  113. data/ext/cached/ruby-1.8.2/evalinfo.h +60 -0
  114. data/ext/cached/ruby-1.8.2/global_entry.h +10 -0
  115. data/ext/cached/ruby-1.8.2/insns_info.c +40 -0
  116. data/ext/cached/ruby-1.8.2/insns_info.h +19 -0
  117. data/ext/cached/ruby-1.8.2/node_type_descrip.c +150 -0
  118. data/ext/cached/ruby-1.8.2/nodeinfo.c +3199 -0
  119. data/ext/cached/ruby-1.8.2/nodeinfo.h +66 -0
  120. data/ext/cached/ruby-1.8.3/COPYING +56 -0
  121. data/ext/cached/ruby-1.8.3/GPL +340 -0
  122. data/ext/cached/ruby-1.8.3/LEGAL +370 -0
  123. data/ext/cached/ruby-1.8.3/LGPL +504 -0
  124. data/ext/cached/ruby-1.8.3/README +3 -0
  125. data/ext/cached/ruby-1.8.3/classpath.c +45 -0
  126. data/ext/cached/ruby-1.8.3/classpath.h +17 -0
  127. data/ext/cached/ruby-1.8.3/evalinfo.h +61 -0
  128. data/ext/cached/ruby-1.8.3/global_entry.h +10 -0
  129. data/ext/cached/ruby-1.8.3/insns_info.c +40 -0
  130. data/ext/cached/ruby-1.8.3/insns_info.h +19 -0
  131. data/ext/cached/ruby-1.8.3/node_type_descrip.c +150 -0
  132. data/ext/cached/ruby-1.8.3/nodeinfo.c +3199 -0
  133. data/ext/cached/ruby-1.8.3/nodeinfo.h +66 -0
  134. data/ext/cached/ruby-1.8.4/COPYING +56 -0
  135. data/ext/cached/ruby-1.8.4/GPL +340 -0
  136. data/ext/cached/ruby-1.8.4/LEGAL +370 -0
  137. data/ext/cached/ruby-1.8.4/LGPL +504 -0
  138. data/ext/cached/ruby-1.8.4/README +3 -0
  139. data/ext/cached/ruby-1.8.4/classpath.c +45 -0
  140. data/ext/cached/ruby-1.8.4/classpath.h +17 -0
  141. data/ext/cached/ruby-1.8.4/evalinfo.h +61 -0
  142. data/ext/cached/ruby-1.8.4/global_entry.h +10 -0
  143. data/ext/cached/ruby-1.8.4/insns_info.c +40 -0
  144. data/ext/cached/ruby-1.8.4/insns_info.h +19 -0
  145. data/ext/cached/ruby-1.8.4/node_type_descrip.c +150 -0
  146. data/ext/cached/ruby-1.8.4/nodeinfo.c +3199 -0
  147. data/ext/cached/ruby-1.8.4/nodeinfo.h +66 -0
  148. data/ext/cached/ruby-1.8.5/COPYING +56 -0
  149. data/ext/cached/ruby-1.8.5/GPL +340 -0
  150. data/ext/cached/ruby-1.8.5/LEGAL +370 -0
  151. data/ext/cached/ruby-1.8.5/LGPL +504 -0
  152. data/ext/cached/ruby-1.8.5/README +3 -0
  153. data/ext/cached/ruby-1.8.5/classpath.c +45 -0
  154. data/ext/cached/ruby-1.8.5/classpath.h +17 -0
  155. data/ext/cached/ruby-1.8.5/evalinfo.h +61 -0
  156. data/ext/cached/ruby-1.8.5/global_entry.h +10 -0
  157. data/ext/cached/ruby-1.8.5/insns_info.c +40 -0
  158. data/ext/cached/ruby-1.8.5/insns_info.h +19 -0
  159. data/ext/cached/ruby-1.8.5/node_type_descrip.c +150 -0
  160. data/ext/cached/ruby-1.8.5/nodeinfo.c +3187 -0
  161. data/ext/cached/ruby-1.8.5/nodeinfo.h +64 -0
  162. data/ext/cached/ruby-1.8.6/COPYING +56 -0
  163. data/ext/cached/ruby-1.8.6/GPL +340 -0
  164. data/ext/cached/ruby-1.8.6/LEGAL +370 -0
  165. data/ext/cached/ruby-1.8.6/LGPL +504 -0
  166. data/ext/cached/ruby-1.8.6/README +3 -0
  167. data/ext/cached/ruby-1.8.6/classpath.c +45 -0
  168. data/ext/cached/ruby-1.8.6/classpath.h +17 -0
  169. data/ext/cached/ruby-1.8.6/evalinfo.h +61 -0
  170. data/ext/cached/ruby-1.8.6/global_entry.h +10 -0
  171. data/ext/cached/ruby-1.8.6/insns_info.c +40 -0
  172. data/ext/cached/ruby-1.8.6/insns_info.h +19 -0
  173. data/ext/cached/ruby-1.8.6/node_type_descrip.c +150 -0
  174. data/ext/cached/ruby-1.8.6/nodeinfo.c +3187 -0
  175. data/ext/cached/ruby-1.8.6/nodeinfo.h +64 -0
  176. data/ext/classpath.c +42 -0
  177. data/ext/classpath.c.rpp +28 -0
  178. data/ext/classpath.h +17 -0
  179. data/ext/classpath.h.rpp +35 -0
  180. data/ext/evalinfo.h +21 -0
  181. data/ext/evalinfo.h.rpp +49 -0
  182. data/ext/extconf.rb +68 -0
  183. data/ext/generate.rb +201 -0
  184. data/ext/generate_cached.rb +49 -0
  185. data/ext/global_entry.h +10 -0
  186. data/ext/global_entry.h.rpp +25 -0
  187. data/ext/insns_info.c +6079 -0
  188. data/ext/insns_info.c.rpp +210 -0
  189. data/ext/insns_info.h +819 -0
  190. data/ext/insns_info.h.rpp +50 -0
  191. data/ext/node_type_descrip.c +148 -0
  192. data/ext/node_type_descrip.c.rpp +72 -0
  193. data/ext/node_type_descrip.h +17 -0
  194. data/ext/node_type_descrip.rb +169 -0
  195. data/ext/nodeinfo.c +3164 -0
  196. data/ext/nodeinfo.c.rpp +519 -0
  197. data/ext/nodeinfo.h +67 -0
  198. data/ext/nodeinfo.h.rpp +27 -0
  199. data/ext/nodewrap.c +2576 -0
  200. data/ext/nodewrap.h +20 -0
  201. data/ext/read_node_h.rb +19 -0
  202. data/ext/ruby_source_dir.rb +15 -0
  203. data/ext/ruby_version.h +12 -0
  204. data/ext/ruby_version_code.rb +16 -0
  205. data/ext/rubypp.rb +97 -0
  206. data/ext/test.rb +15 -0
  207. data/generate_rdoc.rb +33 -0
  208. data/install.rb +1022 -0
  209. data/lib/as_code.rb +347 -0
  210. data/lib/as_expression.rb +657 -0
  211. data/lib/bytedecoder.rb +848 -0
  212. data/lib/classtree.rb +54 -0
  213. data/lib/methodsig.rb +266 -0
  214. data/lib/node_to_a.rb +34 -0
  215. data/lib/nodepp.rb +71 -0
  216. data/lib/nwdebug.rb +18 -0
  217. data/lib/nwdump.rb +53 -0
  218. data/lib/nwobfusc.rb +57 -0
  219. data/lib/procsig.rb +182 -0
  220. data/lib/test.rb +8 -0
  221. data/metaconfig +10 -0
  222. data/post-config.rb +53 -0
  223. data/post-setup.rb +9 -0
  224. data/pre-config.rb +1 -0
  225. data/run_tests.rb +48 -0
  226. data/test/expression_samples.rb +158 -0
  227. data/test/node_samples.rb +122 -0
  228. data/test/test.rb +39 -0
  229. data/test/test2.rb +7 -0
  230. data/test/test3.rb +5 -0
  231. data/test/test4.rb +5 -0
  232. data/test/test_as_code.rb +249 -0
  233. data/test/test_as_expression.rb +222 -0
  234. data/test/test_methodsig.rb +189 -0
  235. data/test/test_nodewrap.rb +369 -0
  236. metadata +286 -0
@@ -0,0 +1,3 @@
1
+ The files in this directory have been generated from the ruby source
2
+ code, version 1.8.6, which are licensed under the Ruby
3
+ license. For more information, please see the file COPYING.
@@ -0,0 +1,45 @@
1
+ #include "classpath.h"
2
+
3
+ VALUE
4
+ class2path(klass)
5
+ VALUE klass;
6
+ {
7
+ VALUE path = rb_class_path(klass);
8
+ char *n = RSTRING(path)->ptr;
9
+
10
+ if (n[0] == '#') {
11
+ rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
12
+ (TYPE(klass) == T_CLASS ? "class" : "module"),
13
+ n);
14
+ }
15
+ if (rb_path2class(n) != rb_class_real(klass)) {
16
+ rb_raise(rb_eTypeError, "%s can't be referred", n);
17
+ }
18
+ return path;
19
+ }
20
+
21
+ VALUE
22
+ path2class(path)
23
+ char *path;
24
+ {
25
+ VALUE v = rb_path2class(path);
26
+
27
+ if (TYPE(v) != T_CLASS) {
28
+ rb_raise(rb_eArgError, "%s does not refer class", path);
29
+ }
30
+ return v;
31
+ }
32
+
33
+ VALUE
34
+ path2module(path)
35
+ char *path;
36
+ {
37
+ VALUE v = rb_path2class(path);
38
+
39
+ if (TYPE(v) != T_MODULE) {
40
+ rb_raise(rb_eArgError, "%s does not refer module", path);
41
+ }
42
+ return v;
43
+ }
44
+
45
+
@@ -0,0 +1,17 @@
1
+ #ifndef CLASSPATH_H
2
+ #define CLASSPATH_H
3
+
4
+ #include "ruby.h"
5
+
6
+ VALUE class2path(
7
+ VALUE klass
8
+ );
9
+ VALUE path2class(
10
+ char *path
11
+ );
12
+ VALUE path2module(
13
+ char *path
14
+ );
15
+
16
+ #endif
17
+
@@ -0,0 +1,61 @@
1
+ #ifndef evalinfo__h_
2
+ #define evalinfo__h_
3
+
4
+ #include "ruby_version.h"
5
+
6
+ #ifdef RUBY_HAS_YARV
7
+ #include "yarvcore.h"
8
+ #else
9
+ #include "env.h"
10
+ #endif
11
+
12
+ struct BLOCK {
13
+ NODE *var;
14
+ NODE *body;
15
+ VALUE self;
16
+ struct FRAME frame;
17
+ struct SCOPE *scope;
18
+ VALUE klass;
19
+ NODE *cref;
20
+ int iter;
21
+ int vmode;
22
+ int flags;
23
+ int uniq;
24
+ struct RVarmap *dyna_vars;
25
+ VALUE orig_thread;
26
+ VALUE wrapper;
27
+ VALUE block_obj;
28
+ struct BLOCK *outer;
29
+ struct BLOCK *prev;
30
+ };
31
+
32
+ static void
33
+ compile_error(at)
34
+ const char *at;
35
+ {
36
+ VALUE str;
37
+
38
+ ruby_nerrs = 0;
39
+ str = rb_str_buf_new2("compile error");
40
+ if (at) {
41
+ rb_str_buf_cat2(str, " in ");
42
+ rb_str_buf_cat2(str, at);
43
+ }
44
+ rb_str_buf_cat(str, "\n", 1);
45
+ if (!NIL_P(ruby_errinfo)) {
46
+ rb_str_append(str, rb_obj_as_string(ruby_errinfo));
47
+ }
48
+ rb_exc_raise(rb_exc_new3(rb_eSyntaxError, str));
49
+ }
50
+
51
+ struct METHOD {
52
+ VALUE klass, rklass;
53
+ VALUE recv;
54
+ ID id, oid;
55
+ int safe_level;
56
+ NODE *body;
57
+ };
58
+
59
+
60
+ #endif
61
+
@@ -0,0 +1,10 @@
1
+ #ifndef global_entry__h_
2
+ #define global_entry__h_
3
+
4
+ struct global_entry {
5
+ struct global_variable *var;
6
+ ID id;
7
+ };
8
+
9
+ #endif
10
+
@@ -0,0 +1,40 @@
1
+ #include "insns_info.h"
2
+ #include "ruby_version.h"
3
+
4
+ #ifdef RUBY_HAS_YARV
5
+
6
+
7
+ VALUE instruction_class[YARV_MAX_INSTRUCTION_SIZE];
8
+
9
+ static ID operand_type_name_of(int operand_type)
10
+ {
11
+ char const * retval = "????";
12
+
13
+ switch(operand_type)
14
+ {
15
+ case TS_ISEQ: retval = "iseq"; break;
16
+ case TS_GENTRY: retval = "gentry"; break;
17
+ case TS_OFFSET: retval = "operand"; break;
18
+ case TS_DINDEX: retval = "dindex"; break;
19
+ case TS_VARIABLE: retval = "variable"; break;
20
+ case TS_CDHASH: retval = "cdhash"; break;
21
+ case TS_IC: retval = "ic"; break;
22
+ case TS_ID: retval = "id"; break;
23
+ case TS_VALUE: retval = "value"; break;
24
+ case TS_LINDEX: retval = "lindex"; break;
25
+ case TS_NUM: retval = "num"; break;
26
+ }
27
+
28
+ return rb_intern(retval);
29
+ }
30
+
31
+
32
+ void define_instruction_subclasses(VALUE rb_cInstruction)
33
+ {
34
+ /* For rdoc: rb_cVM = rb_define_class("VM", rb_cObject); */
35
+ /* For rdoc: rb_cInstruction = rb_define_class_under(rb_cVM, "Instruction", rb_cObject); */
36
+
37
+ }
38
+
39
+ #endif
40
+
@@ -0,0 +1,19 @@
1
+ #ifndef insns_info__h_
2
+ #define insns_info__h_
3
+
4
+ #include "ruby_version.h"
5
+
6
+ #ifdef RUBY_HAS_YARV
7
+
8
+ #include "vm.h"
9
+ #include "ruby.h"
10
+ #include "yarvcore.h"
11
+
12
+
13
+ extern VALUE instruction_class[YARV_MAX_INSTRUCTION_SIZE];
14
+ void define_instruction_subclasses(VALUE rb_cInstruction);
15
+
16
+ #endif
17
+
18
+ #endif
19
+
@@ -0,0 +1,150 @@
1
+ #include "node_type_descrip.h"
2
+ #include "version.h"
3
+
4
+ Node_Type_Descrip node_type_descrips_unsorted[] = {
5
+ { NODE_BLOCK, NEN_HEAD, NEN_NEXT, NEN_NONE, "BLOCK" },
6
+ { NODE_POSTEXE, NEN_NONE, NEN_NONE, NEN_NONE, "POSTEXE" },
7
+ { NODE_BEGIN, NEN_BODY, NEN_NONE, NEN_NONE, "BEGIN" },
8
+ { NODE_MATCH, NEN_HEAD, NEN_NONE, NEN_NONE, "MATCH" },
9
+ { NODE_MATCH2, NEN_RECV, NEN_VALUE, NEN_NONE, "MATCH2" },
10
+ { NODE_MATCH3, NEN_RECV, NEN_VALUE, NEN_NONE, "MATCH3" },
11
+ { NODE_OPT_N, NEN_BODY, NEN_NONE, NEN_NONE, "OPT_N" },
12
+ { NODE_SELF, NEN_NONE, NEN_NONE, NEN_NONE, "SELF" },
13
+ { NODE_NIL, NEN_NONE, NEN_NONE, NEN_NONE, "NIL" },
14
+ { NODE_TRUE, NEN_NONE, NEN_NONE, NEN_NONE, "TRUE" },
15
+ { NODE_FALSE, NEN_NONE, NEN_NONE, NEN_NONE, "FALSE" },
16
+ { NODE_IF, NEN_BODY, NEN_ELSE, NEN_COND, "IF" },
17
+ { NODE_WHEN, NEN_HEAD, NEN_BODY, NEN_NEXT, "WHEN" },
18
+ { NODE_CASE, NEN_HEAD, NEN_BODY, NEN_NEXT, "CASE" },
19
+ { NODE_WHILE, NEN_COND, NEN_BODY, NEN_STATE, "WHILE" },
20
+ { NODE_UNTIL, NEN_COND, NEN_BODY, NEN_STATE, "UNTIL" },
21
+ { NODE_BLOCK_PASS, NEN_BODY, NEN_ITER, NEN_NONE, "BLOCK_PASS" },
22
+ { NODE_ITER, NEN_VAR, NEN_BODY, NEN_ITER, "ITER" },
23
+ { NODE_FOR, NEN_VAR, NEN_BODY, NEN_ITER, "FOR" },
24
+ { NODE_BREAK, NEN_STTS, NEN_NONE, NEN_NONE, "BREAK" },
25
+ { NODE_NEXT, NEN_STTS, NEN_NONE, NEN_NONE, "NEXT" },
26
+ { NODE_REDO, NEN_NONE, NEN_NONE, NEN_NONE, "REDO" },
27
+ { NODE_RETRY, NEN_NONE, NEN_NONE, NEN_NONE, "RETRY" },
28
+ { NODE_YIELD, NEN_STTS, NEN_NONE, NEN_NONE, "YIELD" },
29
+ { NODE_RESCUE, NEN_HEAD, NEN_RESQ, NEN_ELSE, "RESCUE" },
30
+ { NODE_RESBODY, NEN_HEAD, NEN_RESQ, NEN_ENSR, "RESBODY" },
31
+ { NODE_ENSURE, NEN_HEAD, NEN_ENSR, NEN_NONE, "ENSURE" },
32
+ { NODE_AND, NEN_1ST, NEN_2ND, NEN_NONE, "AND" },
33
+ { NODE_OR, NEN_1ST, NEN_2ND, NEN_NONE, "OR" },
34
+ { NODE_NOT, NEN_BODY, NEN_NONE, NEN_NONE, "NOT" },
35
+ { NODE_DOT2, NEN_BEG, NEN_END, NEN_STATE, "DOT2" },
36
+ { NODE_DOT3, NEN_BEG, NEN_END, NEN_STATE, "DOT3" },
37
+ { NODE_FLIP2, NEN_CNT, NEN_BEG, NEN_END, "FLIP2" },
38
+ { NODE_FLIP3, NEN_CNT, NEN_BEG, NEN_END, "FLIP3" },
39
+ { NODE_RETURN, NEN_STTS, NEN_NONE, NEN_NONE, "RETURN" },
40
+ { NODE_ARGS, NEN_CNT, NEN_REST, NEN_OPT, "ARGS" },
41
+ { NODE_ARGSCAT, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSCAT" },
42
+ { NODE_ARGSPUSH, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSPUSH" },
43
+ { NODE_CALL, NEN_RECV, NEN_ARGS, NEN_MID, "CALL" },
44
+ { NODE_FCALL, NEN_ARGS, NEN_MID, NEN_NONE, "FCALL" },
45
+ { NODE_VCALL, NEN_MID, NEN_NONE, NEN_NONE, "VCALL" },
46
+ { NODE_SUPER, NEN_ARGS, NEN_NONE, NEN_NONE, "SUPER" },
47
+ { NODE_ZSUPER, NEN_ARGS, NEN_NONE, NEN_NONE, "ZSUPER" },
48
+ { NODE_SCOPE, NEN_RVAL, NEN_TBL, NEN_NEXT, "SCOPE" },
49
+ { NODE_OP_ASGN1, NEN_RECV, NEN_ARGS, NEN_MID, "OP_ASGN1" },
50
+ { NODE_OP_ASGN2, NEN_VID, NEN_RECV, NEN_VALUE, "OP_ASGN2" },
51
+ { NODE_OP_ASGN_AND, NEN_HEAD, NEN_VALUE, NEN_NONE, "OP_ASGN_AND" },
52
+ { NODE_OP_ASGN_OR, NEN_HEAD, NEN_VALUE, NEN_NONE, "OP_ASGN_OR" },
53
+ { NODE_MASGN, NEN_VALUE, NEN_HEAD, NEN_ARGS, "MASGN" },
54
+ { NODE_LASGN, NEN_VID, NEN_VALUE, NEN_CNT, "LASGN" },
55
+ { NODE_DASGN, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN" },
56
+ { NODE_DASGN_CURR, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN_CURR" },
57
+ { NODE_GASGN, NEN_VID, NEN_VALUE, NEN_ENTRY, "GASGN" },
58
+ { NODE_IASGN, NEN_VID, NEN_VALUE, NEN_NONE, "IASGN" },
59
+ { NODE_CDECL, NEN_VID, NEN_VALUE, NEN_NONE, "CDECL" },
60
+ { NODE_CVDECL, NEN_VALUE, NEN_VID, NEN_NONE, "CVDECL" },
61
+ { NODE_CVASGN, NEN_VALUE, NEN_VID, NEN_NONE, "CVASGN" },
62
+ { NODE_LVAR, NEN_CNT, NEN_VID, NEN_NONE, "LVAR" },
63
+ { NODE_DVAR, NEN_VID, NEN_NONE, NEN_NONE, "DVAR" },
64
+ { NODE_GVAR, NEN_VID, NEN_ENTRY, NEN_NONE, "GVAR" },
65
+ { NODE_IVAR, NEN_VID, NEN_NONE, NEN_NONE, "IVAR" },
66
+ { NODE_CONST, NEN_VID, NEN_NONE, NEN_NONE, "CONST" },
67
+ { NODE_CVAR, NEN_VID, NEN_NONE, NEN_NONE, "CVAR" },
68
+ { NODE_BLOCK_ARG, NEN_CNT, NEN_NONE, NEN_NONE, "BLOCK_ARG" },
69
+ { NODE_COLON2, NEN_HEAD, NEN_MID, NEN_NONE, "COLON2" },
70
+ { NODE_COLON3, NEN_MID, NEN_NONE, NEN_NONE, "COLON3" },
71
+ { NODE_NTH_REF, NEN_NTH, NEN_CNT, NEN_NONE, "NTH_REF" },
72
+ { NODE_BACK_REF, NEN_NTH, NEN_CNT, NEN_NONE, "BACK_REF" },
73
+ { NODE_HASH, NEN_HEAD, NEN_NONE, NEN_NONE, "HASH" },
74
+ { NODE_ZARRAY, NEN_NONE, NEN_NONE, NEN_NONE, "ZARRAY" },
75
+ { NODE_ARRAY, NEN_ALEN, NEN_HEAD, NEN_NEXT, "ARRAY" },
76
+ { NODE_STR, NEN_LIT, NEN_NONE, NEN_NONE, "STR" },
77
+ { NODE_DREGX, NEN_LIT, NEN_NEXT, NEN_CFLAG, "DREGX" },
78
+ { NODE_DREGX_ONCE, NEN_LIT, NEN_NEXT, NEN_CFLAG, "DREGX_ONCE" },
79
+ { NODE_DSTR, NEN_LIT, NEN_NEXT, NEN_NONE, "DSTR" },
80
+ { NODE_DXSTR, NEN_LIT, NEN_NEXT, NEN_NONE, "DXSTR" },
81
+ { NODE_XSTR, NEN_LIT, NEN_NONE, NEN_NONE, "XSTR" },
82
+ #if defined(C_ALLOCA) || RUBY_VERSION_CODE >= 190
83
+ { NODE_ALLOCA, NEN_LIT, NEN_VALUE, NEN_CNT, "ALLOCA" },
84
+ #endif
85
+ { NODE_LIT, NEN_LIT, NEN_NONE, NEN_NONE, "LIT" },
86
+ { NODE_ATTRSET, NEN_VID, NEN_NONE, NEN_NONE, "ATTRSET" },
87
+ { NODE_DEFN, NEN_DEFN, NEN_MID, NEN_NOEX, "DEFN" },
88
+ { NODE_DEFS, NEN_DEFN, NEN_RECV, NEN_MID, "DEFS" },
89
+ { NODE_UNDEF, NEN_MID, NEN_NONE, NEN_NONE, "UNDEF" },
90
+ { NODE_ALIAS, NEN_1ST, NEN_2ND, NEN_NONE, "ALIAS" },
91
+ { NODE_VALIAS, NEN_1ST, NEN_2ND, NEN_NONE, "VALIAS" },
92
+ { NODE_SCLASS, NEN_RECV, NEN_BODY, NEN_NONE, "SCLASS" },
93
+ { NODE_DEFINED, NEN_HEAD, NEN_NONE, NEN_NONE, "DEFINED" },
94
+ { NODE_IFUNC, NEN_CFNC, NEN_TVAL, NEN_ARGC, "IFUNC" },
95
+ { NODE_CFUNC, NEN_CFNC, NEN_TVAL, NEN_ARGC, "CFUNC" },
96
+ { NODE_CREF, NEN_CLSS, NEN_NEXT, NEN_BODY, "CREF" },
97
+ { NODE_BMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "BMETHOD" },
98
+ { NODE_MEMO, NEN_LIT, NEN_TVAL, NEN_NONE, "MEMO" },
99
+ { NODE_EVSTR, NEN_BODY, NEN_NONE, NEN_NONE, "EVSTR" },
100
+ { NODE_DMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "DMETHOD" },
101
+ { NODE_NEWLINE, NEN_NTH, NEN_NEXT, NEN_NONE, "NEWLINE" },
102
+ { NODE_METHOD, NEN_NOEX, NEN_BODY, NEN_NONE, "METHOD" },
103
+ { NODE_FBODY, NEN_ORIG, NEN_MID, NEN_HEAD, "FBODY" },
104
+ { NODE_CLASS, NEN_SUPER, NEN_CPATH, NEN_BODY, "CLASS" },
105
+ { NODE_MODULE, NEN_CPATH, NEN_BODY, NEN_NONE, "MODULE" },
106
+ { NODE_DSYM, NEN_LIT, NEN_NEXT, NEN_NONE, "DSYM" },
107
+ { NODE_ATTRASGN, NEN_MID, NEN_RECV, NEN_ARGS, "ATTRASGN" },
108
+ { NODE_LAST, NEN_NONE, NEN_NONE, NEN_NONE, "LAST" },
109
+ };
110
+
111
+ static Node_Type_Descrip * node_type_descrips[NODE_LAST];
112
+ static int node_type_descrips_initialized = 0;
113
+
114
+ static void init_node_type_descrips()
115
+ {
116
+ if(!node_type_descrips_initialized)
117
+ {
118
+ Node_Type_Descrip * descrip;
119
+ memset(node_type_descrips, 0, sizeof(node_type_descrips));
120
+ for(descrip = node_type_descrips_unsorted;
121
+ descrip->nt != NODE_LAST;
122
+ ++descrip)
123
+ {
124
+ if(node_type_descrips[descrip->nt])
125
+ {
126
+ rb_raise(rb_eRuntimeError, "duplicate entry for %d\n", descrip->nt);
127
+ }
128
+ else
129
+ {
130
+ node_type_descrips[descrip->nt] = descrip;
131
+ }
132
+ }
133
+ node_type_descrips_initialized = 1;
134
+ }
135
+ }
136
+
137
+ /* Given a node, find out the types of the three elements it contains */
138
+ Node_Type_Descrip const * node_type_descrip(enum node_type nt)
139
+ {
140
+ init_node_type_descrips();
141
+ if(node_type_descrips[nt])
142
+ {
143
+ return node_type_descrips[nt];
144
+ }
145
+ else
146
+ {
147
+ rb_raise(rb_eArgError, "Unknown node type %d", nt);
148
+ }
149
+ }
150
+
@@ -0,0 +1,3187 @@
1
+ #include "nodeinfo.h"
2
+ #include "version.h"
3
+ #include "global_entry.h"
4
+ #include "builtins.h"
5
+
6
+ static int is_flip_state(ID id)
7
+ {
8
+ if(id == 0)
9
+ {
10
+ return 1;
11
+ }
12
+ #if RUBY_VERSION_CODE >= 180
13
+ if(!rb_is_local_id(id))
14
+ {
15
+ return 1;
16
+ }
17
+ #endif
18
+ return 0;
19
+ }
20
+
21
+ static VALUE variable_names(ID * tbl)
22
+ {
23
+ if(tbl)
24
+ {
25
+ size_t j;
26
+ VALUE arr = rb_ary_new();
27
+ /* A tbl contains the names of local variables. The first
28
+ * element is the size of the table. The next two elements
29
+ * are $_ and $~. The rest of the elements are the names of
30
+ * the variables themselves.
31
+ */
32
+ for(j = 3; j <= tbl[0]; ++j)
33
+ {
34
+ if(is_flip_state(tbl[j]))
35
+ {
36
+ /* flip state */
37
+ rb_ary_push(arr, Qnil);
38
+ }
39
+ else
40
+ {
41
+ rb_ary_push(arr, ID2SYM(tbl[j]));
42
+ }
43
+ }
44
+ return arr;
45
+ }
46
+ else
47
+ {
48
+ return Qnil;
49
+ }
50
+ }
51
+
52
+ /* Every node contains three elements. This function takes any one of
53
+ * those elements, converts it to a Ruby object that can be dumped
54
+ * (since nodes can't be dumped), and puts the resulting object into
55
+ * node_hash.
56
+ */
57
+ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash)
58
+ {
59
+ switch(nen)
60
+ {
61
+ case NEN_NONE:
62
+ return Qnil;
63
+ case NEN_1ST:
64
+ if(n->nd_1st)
65
+ {
66
+ dump_node_or_iseq_to_hash((VALUE)n->nd_1st, node_hash);
67
+ return node_id(n->nd_1st);
68
+ }
69
+ else
70
+ {
71
+ return Qnil;
72
+ }
73
+ case NEN_2ND:
74
+ if(n->nd_2nd)
75
+ {
76
+ dump_node_or_iseq_to_hash((VALUE)n->nd_2nd, node_hash);
77
+ return node_id(n->nd_2nd);
78
+ }
79
+ else
80
+ {
81
+ return Qnil;
82
+ }
83
+ case NEN_AID:
84
+ if(n->nd_aid == 0)
85
+ {
86
+ return Qnil;
87
+ }
88
+ else
89
+ {
90
+ return ID2SYM(n->nd_aid);
91
+ }
92
+ case NEN_ALEN:
93
+ {
94
+ return LONG2NUM((long)n->nd_alen);
95
+ }
96
+ case NEN_ARGC:
97
+ {
98
+ return LONG2NUM((long)n->nd_argc);
99
+ }
100
+ case NEN_ARGS:
101
+ if(n->nd_args)
102
+ {
103
+ dump_node_or_iseq_to_hash((VALUE)n->nd_args, node_hash);
104
+ return node_id(n->nd_args);
105
+ }
106
+ else
107
+ {
108
+ return Qnil;
109
+ }
110
+ case NEN_BEG:
111
+ if(n->nd_beg)
112
+ {
113
+ dump_node_or_iseq_to_hash((VALUE)n->nd_beg, node_hash);
114
+ return node_id(n->nd_beg);
115
+ }
116
+ else
117
+ {
118
+ return Qnil;
119
+ }
120
+ case NEN_BODY:
121
+ if(n->nd_body)
122
+ {
123
+ dump_node_or_iseq_to_hash((VALUE)n->nd_body, node_hash);
124
+ return node_id(n->nd_body);
125
+ }
126
+ else
127
+ {
128
+ return Qnil;
129
+ }
130
+ case NEN_CFLAG:
131
+ {
132
+ return LONG2NUM((long)n->nd_cflag);
133
+ }
134
+ case NEN_CFNC:
135
+ /* rb_funcall(rb_cObject, rb_intern("pp"), wrap_node(n), 0); */
136
+ rb_raise(rb_eArgError, "Cannot dump cfunc");
137
+ case NEN_CLSS:
138
+ switch(TYPE(n->nd_clss))
139
+ {
140
+ case T_CLASS:
141
+ case T_MODULE:
142
+ {
143
+ /* When dumping a class, we dump just the name (otherwise we'd
144
+ * get multiple copies of the class each time we load a method
145
+ * on the other side).
146
+ */
147
+ VALUE klass = (VALUE)n->nd_clss;
148
+ VALUE path;
149
+ if(FL_TEST(klass, FL_SINGLETON))
150
+ {
151
+ VALUE singleton = rb_iv_get(klass, "__attached__");
152
+ path = rb_class_path(singleton);
153
+ }
154
+ else
155
+ {
156
+ path = rb_class_path(klass);
157
+ if(STR2CSTR(path)[0] == '#')
158
+ {
159
+ rb_raise(rb_eArgError, "cannot dump anonymous class");
160
+ }
161
+ }
162
+ return rb_assoc_new(
163
+ INT2NUM(((struct RBasic *)(n->nd_clss))->flags),
164
+ path);
165
+ }
166
+
167
+ default:
168
+ /* TODO: would like to dump flags, not type */
169
+ return rb_assoc_new(
170
+ INT2NUM(TYPE((VALUE)n->nd_clss)),
171
+ (VALUE)n->nd_clss);
172
+ }
173
+ case NEN_CNT:
174
+ {
175
+ return LONG2NUM((long)n->nd_cnt);
176
+ }
177
+ case NEN_COND:
178
+ if(n->nd_cond)
179
+ {
180
+ dump_node_or_iseq_to_hash((VALUE)n->nd_cond, node_hash);
181
+ return node_id(n->nd_cond);
182
+ }
183
+ else
184
+ {
185
+ return Qnil;
186
+ }
187
+ case NEN_CPATH:
188
+ if(n->nd_cpath)
189
+ {
190
+ dump_node_or_iseq_to_hash((VALUE)n->nd_cpath, node_hash);
191
+ return node_id(n->nd_cpath);
192
+ }
193
+ else
194
+ {
195
+ return Qnil;
196
+ }
197
+ case NEN_CVAL:
198
+ switch(TYPE(n->nd_cval))
199
+ {
200
+ case T_CLASS:
201
+ case T_MODULE:
202
+ {
203
+ /* When dumping a class, we dump just the name (otherwise we'd
204
+ * get multiple copies of the class each time we load a method
205
+ * on the other side).
206
+ */
207
+ VALUE klass = (VALUE)n->nd_cval;
208
+ VALUE path;
209
+ if(FL_TEST(klass, FL_SINGLETON))
210
+ {
211
+ VALUE singleton = rb_iv_get(klass, "__attached__");
212
+ path = rb_class_path(singleton);
213
+ }
214
+ else
215
+ {
216
+ path = rb_class_path(klass);
217
+ if(STR2CSTR(path)[0] == '#')
218
+ {
219
+ rb_raise(rb_eArgError, "cannot dump anonymous class");
220
+ }
221
+ }
222
+ return rb_assoc_new(
223
+ INT2NUM(((struct RBasic *)(n->nd_cval))->flags),
224
+ path);
225
+ }
226
+
227
+ default:
228
+ /* TODO: would like to dump flags, not type */
229
+ return rb_assoc_new(
230
+ INT2NUM(TYPE((VALUE)n->nd_cval)),
231
+ (VALUE)n->nd_cval);
232
+ }
233
+ case NEN_DEFN:
234
+ if(n->nd_defn)
235
+ {
236
+ dump_node_or_iseq_to_hash((VALUE)n->nd_defn, node_hash);
237
+ return node_id(n->nd_defn);
238
+ }
239
+ else
240
+ {
241
+ return Qnil;
242
+ }
243
+ case NEN_ELSE:
244
+ if(n->nd_else)
245
+ {
246
+ dump_node_or_iseq_to_hash((VALUE)n->nd_else, node_hash);
247
+ return node_id(n->nd_else);
248
+ }
249
+ else
250
+ {
251
+ return Qnil;
252
+ }
253
+ case NEN_END:
254
+ if(n->nd_end)
255
+ {
256
+ dump_node_or_iseq_to_hash((VALUE)n->nd_end, node_hash);
257
+ return node_id(n->nd_end);
258
+ }
259
+ else
260
+ {
261
+ return Qnil;
262
+ }
263
+ case NEN_ENSR:
264
+ if(n->nd_ensr)
265
+ {
266
+ dump_node_or_iseq_to_hash((VALUE)n->nd_ensr, node_hash);
267
+ return node_id(n->nd_ensr);
268
+ }
269
+ else
270
+ {
271
+ return Qnil;
272
+ }
273
+ case NEN_ENTRY:
274
+ if(n->nd_entry->id == 0)
275
+ {
276
+ rb_raise(
277
+ rb_eRuntimeError,
278
+ "Invalid ID for entry (node type %d)",
279
+ nd_type(n));
280
+ }
281
+ return ID2SYM(n->nd_entry->id);
282
+ case NEN_FRML:
283
+ if(n->nd_frml)
284
+ {
285
+ dump_node_or_iseq_to_hash((VALUE)n->nd_frml, node_hash);
286
+ return node_id(n->nd_frml);
287
+ }
288
+ else
289
+ {
290
+ return Qnil;
291
+ }
292
+ case NEN_HEAD:
293
+ if(n->nd_head)
294
+ {
295
+ dump_node_or_iseq_to_hash((VALUE)n->nd_head, node_hash);
296
+ return node_id(n->nd_head);
297
+ }
298
+ else
299
+ {
300
+ return Qnil;
301
+ }
302
+ case NEN_IBDY:
303
+ if(n->nd_ibdy)
304
+ {
305
+ dump_node_or_iseq_to_hash((VALUE)n->nd_ibdy, node_hash);
306
+ return node_id(n->nd_ibdy);
307
+ }
308
+ else
309
+ {
310
+ return Qnil;
311
+ }
312
+ case NEN_ITER:
313
+ if(n->nd_iter)
314
+ {
315
+ dump_node_or_iseq_to_hash((VALUE)n->nd_iter, node_hash);
316
+ return node_id(n->nd_iter);
317
+ }
318
+ else
319
+ {
320
+ return Qnil;
321
+ }
322
+ case NEN_LIT:
323
+ switch(TYPE(n->nd_lit))
324
+ {
325
+ case T_CLASS:
326
+ case T_MODULE:
327
+ {
328
+ /* When dumping a class, we dump just the name (otherwise we'd
329
+ * get multiple copies of the class each time we load a method
330
+ * on the other side).
331
+ */
332
+ VALUE klass = (VALUE)n->nd_lit;
333
+ VALUE path;
334
+ if(FL_TEST(klass, FL_SINGLETON))
335
+ {
336
+ VALUE singleton = rb_iv_get(klass, "__attached__");
337
+ path = rb_class_path(singleton);
338
+ }
339
+ else
340
+ {
341
+ path = rb_class_path(klass);
342
+ if(STR2CSTR(path)[0] == '#')
343
+ {
344
+ rb_raise(rb_eArgError, "cannot dump anonymous class");
345
+ }
346
+ }
347
+ return rb_assoc_new(
348
+ INT2NUM(((struct RBasic *)(n->nd_lit))->flags),
349
+ path);
350
+ }
351
+
352
+ default:
353
+ /* TODO: would like to dump flags, not type */
354
+ return rb_assoc_new(
355
+ INT2NUM(TYPE((VALUE)n->nd_lit)),
356
+ (VALUE)n->nd_lit);
357
+ }
358
+ case NEN_MID:
359
+ if(n->nd_mid == 0)
360
+ {
361
+ return Qnil;
362
+ }
363
+ else
364
+ {
365
+ return ID2SYM(n->nd_mid);
366
+ }
367
+ case NEN_MODL:
368
+ if(n->nd_modl == 0)
369
+ {
370
+ return Qnil;
371
+ }
372
+ else
373
+ {
374
+ return ID2SYM(n->nd_modl);
375
+ }
376
+ case NEN_NEXT:
377
+ if(n->nd_next)
378
+ {
379
+ dump_node_or_iseq_to_hash((VALUE)n->nd_next, node_hash);
380
+ return node_id(n->nd_next);
381
+ }
382
+ else
383
+ {
384
+ return Qnil;
385
+ }
386
+ case NEN_NOEX:
387
+ {
388
+ return LONG2NUM((long)n->nd_noex);
389
+ }
390
+ case NEN_NTH:
391
+ {
392
+ return LONG2NUM((long)n->nd_nth);
393
+ }
394
+ case NEN_OPT:
395
+ if(n->nd_opt)
396
+ {
397
+ dump_node_or_iseq_to_hash((VALUE)n->nd_opt, node_hash);
398
+ return node_id(n->nd_opt);
399
+ }
400
+ else
401
+ {
402
+ return Qnil;
403
+ }
404
+ case NEN_ORIG:
405
+ switch(TYPE(n->nd_orig))
406
+ {
407
+ case T_CLASS:
408
+ case T_MODULE:
409
+ {
410
+ /* When dumping a class, we dump just the name (otherwise we'd
411
+ * get multiple copies of the class each time we load a method
412
+ * on the other side).
413
+ */
414
+ VALUE klass = (VALUE)n->nd_orig;
415
+ VALUE path;
416
+ if(FL_TEST(klass, FL_SINGLETON))
417
+ {
418
+ VALUE singleton = rb_iv_get(klass, "__attached__");
419
+ path = rb_class_path(singleton);
420
+ }
421
+ else
422
+ {
423
+ path = rb_class_path(klass);
424
+ if(STR2CSTR(path)[0] == '#')
425
+ {
426
+ rb_raise(rb_eArgError, "cannot dump anonymous class");
427
+ }
428
+ }
429
+ return rb_assoc_new(
430
+ INT2NUM(((struct RBasic *)(n->nd_orig))->flags),
431
+ path);
432
+ }
433
+
434
+ default:
435
+ /* TODO: would like to dump flags, not type */
436
+ return rb_assoc_new(
437
+ INT2NUM(TYPE((VALUE)n->nd_orig)),
438
+ (VALUE)n->nd_orig);
439
+ }
440
+ case NEN_RECV:
441
+ if(n->nd_recv)
442
+ {
443
+ dump_node_or_iseq_to_hash((VALUE)n->nd_recv, node_hash);
444
+ return node_id(n->nd_recv);
445
+ }
446
+ else
447
+ {
448
+ return Qnil;
449
+ }
450
+ case NEN_RESQ:
451
+ if(n->nd_resq)
452
+ {
453
+ dump_node_or_iseq_to_hash((VALUE)n->nd_resq, node_hash);
454
+ return node_id(n->nd_resq);
455
+ }
456
+ else
457
+ {
458
+ return Qnil;
459
+ }
460
+ case NEN_REST:
461
+ if(n->nd_rest)
462
+ {
463
+ dump_node_or_iseq_to_hash((VALUE)n->nd_rest, node_hash);
464
+ return node_id(n->nd_rest);
465
+ }
466
+ else
467
+ {
468
+ return Qnil;
469
+ }
470
+ case NEN_RVAL:
471
+ if(n->nd_2nd)
472
+ {
473
+ dump_node_or_iseq_to_hash((VALUE)n->nd_2nd, node_hash);
474
+ return node_id(n->nd_2nd);
475
+ }
476
+ else
477
+ {
478
+ return Qnil;
479
+ }
480
+ case NEN_STATE:
481
+ {
482
+ return LONG2NUM((long)n->nd_state);
483
+ }
484
+ case NEN_STTS:
485
+ if(n->nd_stts)
486
+ {
487
+ dump_node_or_iseq_to_hash((VALUE)n->nd_stts, node_hash);
488
+ return node_id(n->nd_stts);
489
+ }
490
+ else
491
+ {
492
+ return Qnil;
493
+ }
494
+ case NEN_SUPER:
495
+ if(n->nd_super)
496
+ {
497
+ dump_node_or_iseq_to_hash((VALUE)n->nd_super, node_hash);
498
+ return node_id(n->nd_super);
499
+ }
500
+ else
501
+ {
502
+ return Qnil;
503
+ }
504
+ case NEN_TAG:
505
+ if(n->nd_tag == 0)
506
+ {
507
+ return Qnil;
508
+ }
509
+ else
510
+ {
511
+ return ID2SYM(n->nd_tag);
512
+ }
513
+ case NEN_TBL:
514
+ {
515
+ VALUE v = variable_names(n->nd_tbl);
516
+ return v;
517
+ }
518
+ case NEN_TVAL:
519
+ switch(TYPE(n->nd_tval))
520
+ {
521
+ case T_CLASS:
522
+ case T_MODULE:
523
+ {
524
+ /* When dumping a class, we dump just the name (otherwise we'd
525
+ * get multiple copies of the class each time we load a method
526
+ * on the other side).
527
+ */
528
+ VALUE klass = (VALUE)n->nd_tval;
529
+ VALUE path;
530
+ if(FL_TEST(klass, FL_SINGLETON))
531
+ {
532
+ VALUE singleton = rb_iv_get(klass, "__attached__");
533
+ path = rb_class_path(singleton);
534
+ }
535
+ else
536
+ {
537
+ path = rb_class_path(klass);
538
+ if(STR2CSTR(path)[0] == '#')
539
+ {
540
+ rb_raise(rb_eArgError, "cannot dump anonymous class");
541
+ }
542
+ }
543
+ return rb_assoc_new(
544
+ INT2NUM(((struct RBasic *)(n->nd_tval))->flags),
545
+ path);
546
+ }
547
+
548
+ default:
549
+ /* TODO: would like to dump flags, not type */
550
+ return rb_assoc_new(
551
+ INT2NUM(TYPE((VALUE)n->nd_tval)),
552
+ (VALUE)n->nd_tval);
553
+ }
554
+ case NEN_VALUE:
555
+ if(n->nd_value)
556
+ {
557
+ dump_node_or_iseq_to_hash((VALUE)n->nd_value, node_hash);
558
+ return node_id(n->nd_value);
559
+ }
560
+ else
561
+ {
562
+ return Qnil;
563
+ }
564
+ case NEN_VAR:
565
+ if(n->nd_var)
566
+ {
567
+ dump_node_or_iseq_to_hash((VALUE)n->nd_var, node_hash);
568
+ return node_id(n->nd_var);
569
+ }
570
+ else
571
+ {
572
+ return Qnil;
573
+ }
574
+ case NEN_VID:
575
+ if(n->nd_vid == 0)
576
+ {
577
+ return Qnil;
578
+ }
579
+ else
580
+ {
581
+ return ID2SYM(n->nd_vid);
582
+ }
583
+ }
584
+ rb_raise(rb_eArgError, "Invalid Node_Elem_Name %d", nen);
585
+ }
586
+
587
+ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash, VALUE id_hash)
588
+ {
589
+ switch(nen)
590
+ {
591
+ case NEN_NONE:
592
+ return;
593
+ case NEN_1ST:
594
+ {
595
+ if(v == Qnil)
596
+ {
597
+ n->nd_1st = 0;
598
+ }
599
+ else
600
+ {
601
+ VALUE nid = rb_hash_aref(id_hash, v);
602
+ if(RTEST(nid))
603
+ {
604
+ n->nd_1st = id_to_node(nid);
605
+ }
606
+ else
607
+ {
608
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
609
+ v, node_hash, id_hash);
610
+ }
611
+ }
612
+ return;
613
+ }
614
+ case NEN_2ND:
615
+ {
616
+ if(v == Qnil)
617
+ {
618
+ n->nd_2nd = 0;
619
+ }
620
+ else
621
+ {
622
+ VALUE nid = rb_hash_aref(id_hash, v);
623
+ if(RTEST(nid))
624
+ {
625
+ n->nd_2nd = id_to_node(nid);
626
+ }
627
+ else
628
+ {
629
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
630
+ v, node_hash, id_hash);
631
+ }
632
+ }
633
+ return;
634
+ }
635
+ case NEN_AID:
636
+ {
637
+ if(NIL_P(v))
638
+ {
639
+ n->nd_aid = 0;
640
+ }
641
+ else
642
+ {
643
+ n->nd_aid = SYM2ID(v);
644
+ }
645
+ return;
646
+ }
647
+ case NEN_ALEN:
648
+ {
649
+ n->nd_alen = NUM2LONG(v);
650
+ return;
651
+ }
652
+ case NEN_ARGC:
653
+ {
654
+ n->nd_argc = NUM2LONG(v);
655
+ return;
656
+ }
657
+ case NEN_ARGS:
658
+ {
659
+ if(v == Qnil)
660
+ {
661
+ n->nd_args = 0;
662
+ }
663
+ else
664
+ {
665
+ VALUE nid = rb_hash_aref(id_hash, v);
666
+ if(RTEST(nid))
667
+ {
668
+ n->nd_args = id_to_node(nid);
669
+ }
670
+ else
671
+ {
672
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
673
+ v, node_hash, id_hash);
674
+ }
675
+ }
676
+ return;
677
+ }
678
+ case NEN_BEG:
679
+ {
680
+ if(v == Qnil)
681
+ {
682
+ n->nd_beg = 0;
683
+ }
684
+ else
685
+ {
686
+ VALUE nid = rb_hash_aref(id_hash, v);
687
+ if(RTEST(nid))
688
+ {
689
+ n->nd_beg = id_to_node(nid);
690
+ }
691
+ else
692
+ {
693
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
694
+ v, node_hash, id_hash);
695
+ }
696
+ }
697
+ return;
698
+ }
699
+ case NEN_BODY:
700
+ {
701
+ if(v == Qnil)
702
+ {
703
+ n->nd_body = 0;
704
+ }
705
+ else
706
+ {
707
+ VALUE nid = rb_hash_aref(id_hash, v);
708
+ if(RTEST(nid))
709
+ {
710
+ n->nd_body = id_to_node(nid);
711
+ }
712
+ else
713
+ {
714
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
715
+ v, node_hash, id_hash);
716
+ }
717
+ }
718
+ return;
719
+ }
720
+ case NEN_CFLAG:
721
+ {
722
+ n->nd_cflag = NUM2LONG(v);
723
+ return;
724
+ }
725
+ case NEN_CFNC:
726
+ {
727
+ rb_raise(rb_eRuntimeError, "Cannot load cfunc");
728
+ }
729
+ case NEN_CLSS:
730
+ {
731
+ Check_Type(v, T_ARRAY);
732
+ if(RARRAY_LEN(v) != 2)
733
+ {
734
+ rb_raise(rb_eArgError, "wrong size for array");
735
+ }
736
+ int flags = NUM2INT(RARRAY_PTR(v)[0]);
737
+ switch(flags & T_MASK)
738
+ {
739
+ case T_CLASS:
740
+ case T_MODULE:
741
+ {
742
+ VALUE str = RARRAY_PTR(v)[1];
743
+ Check_Type(str, T_STRING);
744
+ VALUE klass = rb_path2class(STR2CSTR(str));
745
+ if(flags & FL_SINGLETON)
746
+ {
747
+ *(VALUE *)(&n->nd_clss) =
748
+ rb_singleton_class(klass);
749
+ }
750
+ else
751
+ {
752
+ *(VALUE *)(&n->nd_clss) =
753
+ klass;
754
+ }
755
+ break;
756
+ }
757
+ default:
758
+ *(VALUE *)(&n->nd_clss) = RARRAY_PTR(v)[1];
759
+ break;
760
+ }
761
+ return;
762
+ }
763
+ case NEN_CNT:
764
+ {
765
+ n->nd_cnt = NUM2LONG(v);
766
+ return;
767
+ }
768
+ case NEN_COND:
769
+ {
770
+ if(v == Qnil)
771
+ {
772
+ n->nd_cond = 0;
773
+ }
774
+ else
775
+ {
776
+ VALUE nid = rb_hash_aref(id_hash, v);
777
+ if(RTEST(nid))
778
+ {
779
+ n->nd_cond = id_to_node(nid);
780
+ }
781
+ else
782
+ {
783
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
784
+ v, node_hash, id_hash);
785
+ }
786
+ }
787
+ return;
788
+ }
789
+ case NEN_CPATH:
790
+ {
791
+ if(v == Qnil)
792
+ {
793
+ n->nd_cpath = 0;
794
+ }
795
+ else
796
+ {
797
+ VALUE nid = rb_hash_aref(id_hash, v);
798
+ if(RTEST(nid))
799
+ {
800
+ n->nd_cpath = id_to_node(nid);
801
+ }
802
+ else
803
+ {
804
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
805
+ v, node_hash, id_hash);
806
+ }
807
+ }
808
+ return;
809
+ }
810
+ case NEN_CVAL:
811
+ {
812
+ Check_Type(v, T_ARRAY);
813
+ if(RARRAY_LEN(v) != 2)
814
+ {
815
+ rb_raise(rb_eArgError, "wrong size for array");
816
+ }
817
+ int flags = NUM2INT(RARRAY_PTR(v)[0]);
818
+ switch(flags & T_MASK)
819
+ {
820
+ case T_CLASS:
821
+ case T_MODULE:
822
+ {
823
+ VALUE str = RARRAY_PTR(v)[1];
824
+ Check_Type(str, T_STRING);
825
+ VALUE klass = rb_path2class(STR2CSTR(str));
826
+ if(flags & FL_SINGLETON)
827
+ {
828
+ *(VALUE *)(&n->nd_cval) =
829
+ rb_singleton_class(klass);
830
+ }
831
+ else
832
+ {
833
+ *(VALUE *)(&n->nd_cval) =
834
+ klass;
835
+ }
836
+ break;
837
+ }
838
+ default:
839
+ *(VALUE *)(&n->nd_cval) = RARRAY_PTR(v)[1];
840
+ break;
841
+ }
842
+ return;
843
+ }
844
+ case NEN_DEFN:
845
+ {
846
+ if(v == Qnil)
847
+ {
848
+ n->nd_defn = 0;
849
+ }
850
+ else
851
+ {
852
+ VALUE nid = rb_hash_aref(id_hash, v);
853
+ if(RTEST(nid))
854
+ {
855
+ n->nd_defn = id_to_node(nid);
856
+ }
857
+ else
858
+ {
859
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
860
+ v, node_hash, id_hash);
861
+ }
862
+ }
863
+ return;
864
+ }
865
+ case NEN_ELSE:
866
+ {
867
+ if(v == Qnil)
868
+ {
869
+ n->nd_else = 0;
870
+ }
871
+ else
872
+ {
873
+ VALUE nid = rb_hash_aref(id_hash, v);
874
+ if(RTEST(nid))
875
+ {
876
+ n->nd_else = id_to_node(nid);
877
+ }
878
+ else
879
+ {
880
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
881
+ v, node_hash, id_hash);
882
+ }
883
+ }
884
+ return;
885
+ }
886
+ case NEN_END:
887
+ {
888
+ if(v == Qnil)
889
+ {
890
+ n->nd_end = 0;
891
+ }
892
+ else
893
+ {
894
+ VALUE nid = rb_hash_aref(id_hash, v);
895
+ if(RTEST(nid))
896
+ {
897
+ n->nd_end = id_to_node(nid);
898
+ }
899
+ else
900
+ {
901
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
902
+ v, node_hash, id_hash);
903
+ }
904
+ }
905
+ return;
906
+ }
907
+ case NEN_ENSR:
908
+ {
909
+ if(v == Qnil)
910
+ {
911
+ n->nd_ensr = 0;
912
+ }
913
+ else
914
+ {
915
+ VALUE nid = rb_hash_aref(id_hash, v);
916
+ if(RTEST(nid))
917
+ {
918
+ n->nd_ensr = id_to_node(nid);
919
+ }
920
+ else
921
+ {
922
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
923
+ v, node_hash, id_hash);
924
+ }
925
+ }
926
+ return;
927
+ }
928
+ case NEN_ENTRY:
929
+ {
930
+ n->nd_entry = rb_global_entry(SYM2ID(v));
931
+ return;
932
+ }
933
+ case NEN_FRML:
934
+ {
935
+ if(v == Qnil)
936
+ {
937
+ n->nd_frml = 0;
938
+ }
939
+ else
940
+ {
941
+ VALUE nid = rb_hash_aref(id_hash, v);
942
+ if(RTEST(nid))
943
+ {
944
+ n->nd_frml = id_to_node(nid);
945
+ }
946
+ else
947
+ {
948
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
949
+ v, node_hash, id_hash);
950
+ }
951
+ }
952
+ return;
953
+ }
954
+ case NEN_HEAD:
955
+ {
956
+ if(v == Qnil)
957
+ {
958
+ n->nd_head = 0;
959
+ }
960
+ else
961
+ {
962
+ VALUE nid = rb_hash_aref(id_hash, v);
963
+ if(RTEST(nid))
964
+ {
965
+ n->nd_head = id_to_node(nid);
966
+ }
967
+ else
968
+ {
969
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
970
+ v, node_hash, id_hash);
971
+ }
972
+ }
973
+ return;
974
+ }
975
+ case NEN_IBDY:
976
+ {
977
+ if(v == Qnil)
978
+ {
979
+ n->nd_ibdy = 0;
980
+ }
981
+ else
982
+ {
983
+ VALUE nid = rb_hash_aref(id_hash, v);
984
+ if(RTEST(nid))
985
+ {
986
+ n->nd_ibdy = id_to_node(nid);
987
+ }
988
+ else
989
+ {
990
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
991
+ v, node_hash, id_hash);
992
+ }
993
+ }
994
+ return;
995
+ }
996
+ case NEN_ITER:
997
+ {
998
+ if(v == Qnil)
999
+ {
1000
+ n->nd_iter = 0;
1001
+ }
1002
+ else
1003
+ {
1004
+ VALUE nid = rb_hash_aref(id_hash, v);
1005
+ if(RTEST(nid))
1006
+ {
1007
+ n->nd_iter = id_to_node(nid);
1008
+ }
1009
+ else
1010
+ {
1011
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
1012
+ v, node_hash, id_hash);
1013
+ }
1014
+ }
1015
+ return;
1016
+ }
1017
+ case NEN_LIT:
1018
+ {
1019
+ Check_Type(v, T_ARRAY);
1020
+ if(RARRAY_LEN(v) != 2)
1021
+ {
1022
+ rb_raise(rb_eArgError, "wrong size for array");
1023
+ }
1024
+ int flags = NUM2INT(RARRAY_PTR(v)[0]);
1025
+ switch(flags & T_MASK)
1026
+ {
1027
+ case T_CLASS:
1028
+ case T_MODULE:
1029
+ {
1030
+ VALUE str = RARRAY_PTR(v)[1];
1031
+ Check_Type(str, T_STRING);
1032
+ VALUE klass = rb_path2class(STR2CSTR(str));
1033
+ if(flags & FL_SINGLETON)
1034
+ {
1035
+ *(VALUE *)(&n->nd_lit) =
1036
+ rb_singleton_class(klass);
1037
+ }
1038
+ else
1039
+ {
1040
+ *(VALUE *)(&n->nd_lit) =
1041
+ klass;
1042
+ }
1043
+ break;
1044
+ }
1045
+ default:
1046
+ *(VALUE *)(&n->nd_lit) = RARRAY_PTR(v)[1];
1047
+ break;
1048
+ }
1049
+ return;
1050
+ }
1051
+ case NEN_MID:
1052
+ {
1053
+ if(NIL_P(v))
1054
+ {
1055
+ n->nd_mid = 0;
1056
+ }
1057
+ else
1058
+ {
1059
+ n->nd_mid = SYM2ID(v);
1060
+ }
1061
+ return;
1062
+ }
1063
+ case NEN_MODL:
1064
+ {
1065
+ if(NIL_P(v))
1066
+ {
1067
+ n->nd_modl = 0;
1068
+ }
1069
+ else
1070
+ {
1071
+ n->nd_modl = SYM2ID(v);
1072
+ }
1073
+ return;
1074
+ }
1075
+ case NEN_NEXT:
1076
+ {
1077
+ if(v == Qnil)
1078
+ {
1079
+ n->nd_next = 0;
1080
+ }
1081
+ else
1082
+ {
1083
+ VALUE nid = rb_hash_aref(id_hash, v);
1084
+ if(RTEST(nid))
1085
+ {
1086
+ n->nd_next = id_to_node(nid);
1087
+ }
1088
+ else
1089
+ {
1090
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
1091
+ v, node_hash, id_hash);
1092
+ }
1093
+ }
1094
+ return;
1095
+ }
1096
+ case NEN_NOEX:
1097
+ {
1098
+ n->nd_noex = NUM2LONG(v);
1099
+ return;
1100
+ }
1101
+ case NEN_NTH:
1102
+ {
1103
+ n->nd_nth = NUM2LONG(v);
1104
+ return;
1105
+ }
1106
+ case NEN_OPT:
1107
+ {
1108
+ if(v == Qnil)
1109
+ {
1110
+ n->nd_opt = 0;
1111
+ }
1112
+ else
1113
+ {
1114
+ VALUE nid = rb_hash_aref(id_hash, v);
1115
+ if(RTEST(nid))
1116
+ {
1117
+ n->nd_opt = id_to_node(nid);
1118
+ }
1119
+ else
1120
+ {
1121
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
1122
+ v, node_hash, id_hash);
1123
+ }
1124
+ }
1125
+ return;
1126
+ }
1127
+ case NEN_ORIG:
1128
+ {
1129
+ Check_Type(v, T_ARRAY);
1130
+ if(RARRAY_LEN(v) != 2)
1131
+ {
1132
+ rb_raise(rb_eArgError, "wrong size for array");
1133
+ }
1134
+ int flags = NUM2INT(RARRAY_PTR(v)[0]);
1135
+ switch(flags & T_MASK)
1136
+ {
1137
+ case T_CLASS:
1138
+ case T_MODULE:
1139
+ {
1140
+ VALUE str = RARRAY_PTR(v)[1];
1141
+ Check_Type(str, T_STRING);
1142
+ VALUE klass = rb_path2class(STR2CSTR(str));
1143
+ if(flags & FL_SINGLETON)
1144
+ {
1145
+ *(VALUE *)(&n->nd_orig) =
1146
+ rb_singleton_class(klass);
1147
+ }
1148
+ else
1149
+ {
1150
+ *(VALUE *)(&n->nd_orig) =
1151
+ klass;
1152
+ }
1153
+ break;
1154
+ }
1155
+ default:
1156
+ *(VALUE *)(&n->nd_orig) = RARRAY_PTR(v)[1];
1157
+ break;
1158
+ }
1159
+ return;
1160
+ }
1161
+ case NEN_RECV:
1162
+ {
1163
+ if(v == Qnil)
1164
+ {
1165
+ n->nd_recv = 0;
1166
+ }
1167
+ else
1168
+ {
1169
+ VALUE nid = rb_hash_aref(id_hash, v);
1170
+ if(RTEST(nid))
1171
+ {
1172
+ n->nd_recv = id_to_node(nid);
1173
+ }
1174
+ else
1175
+ {
1176
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
1177
+ v, node_hash, id_hash);
1178
+ }
1179
+ }
1180
+ return;
1181
+ }
1182
+ case NEN_RESQ:
1183
+ {
1184
+ if(v == Qnil)
1185
+ {
1186
+ n->nd_resq = 0;
1187
+ }
1188
+ else
1189
+ {
1190
+ VALUE nid = rb_hash_aref(id_hash, v);
1191
+ if(RTEST(nid))
1192
+ {
1193
+ n->nd_resq = id_to_node(nid);
1194
+ }
1195
+ else
1196
+ {
1197
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
1198
+ v, node_hash, id_hash);
1199
+ }
1200
+ }
1201
+ return;
1202
+ }
1203
+ case NEN_REST:
1204
+ {
1205
+ if(v == Qnil)
1206
+ {
1207
+ n->nd_rest = 0;
1208
+ }
1209
+ else
1210
+ {
1211
+ VALUE nid = rb_hash_aref(id_hash, v);
1212
+ if(RTEST(nid))
1213
+ {
1214
+ n->nd_rest = id_to_node(nid);
1215
+ }
1216
+ else
1217
+ {
1218
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
1219
+ v, node_hash, id_hash);
1220
+ }
1221
+ }
1222
+ return;
1223
+ }
1224
+ case NEN_RVAL:
1225
+ {
1226
+ if(v == Qnil)
1227
+ {
1228
+ n->nd_2nd = 0;
1229
+ }
1230
+ else
1231
+ {
1232
+ VALUE nid = rb_hash_aref(id_hash, v);
1233
+ if(RTEST(nid))
1234
+ {
1235
+ n->nd_2nd = id_to_node(nid);
1236
+ }
1237
+ else
1238
+ {
1239
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
1240
+ v, node_hash, id_hash);
1241
+ }
1242
+ }
1243
+ return;
1244
+ }
1245
+ case NEN_STATE:
1246
+ {
1247
+ n->nd_state = NUM2LONG(v);
1248
+ return;
1249
+ }
1250
+ case NEN_STTS:
1251
+ {
1252
+ if(v == Qnil)
1253
+ {
1254
+ n->nd_stts = 0;
1255
+ }
1256
+ else
1257
+ {
1258
+ VALUE nid = rb_hash_aref(id_hash, v);
1259
+ if(RTEST(nid))
1260
+ {
1261
+ n->nd_stts = id_to_node(nid);
1262
+ }
1263
+ else
1264
+ {
1265
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
1266
+ v, node_hash, id_hash);
1267
+ }
1268
+ }
1269
+ return;
1270
+ }
1271
+ case NEN_SUPER:
1272
+ {
1273
+ if(v == Qnil)
1274
+ {
1275
+ n->nd_super = 0;
1276
+ }
1277
+ else
1278
+ {
1279
+ VALUE nid = rb_hash_aref(id_hash, v);
1280
+ if(RTEST(nid))
1281
+ {
1282
+ n->nd_super = id_to_node(nid);
1283
+ }
1284
+ else
1285
+ {
1286
+ n->u3.node = (NODE *)load_node_or_iseq_from_hash(
1287
+ v, node_hash, id_hash);
1288
+ }
1289
+ }
1290
+ return;
1291
+ }
1292
+ case NEN_TAG:
1293
+ {
1294
+ if(NIL_P(v))
1295
+ {
1296
+ n->nd_tag = 0;
1297
+ }
1298
+ else
1299
+ {
1300
+ n->nd_tag = SYM2ID(v);
1301
+ }
1302
+ return;
1303
+ }
1304
+ case NEN_TBL:
1305
+ {
1306
+ if(v == Qnil)
1307
+ {
1308
+ n->nd_tbl = 0;
1309
+ }
1310
+ else
1311
+ {
1312
+ size_t len, j;
1313
+ ID * tmp_tbl;
1314
+
1315
+ Check_Type(v, T_ARRAY);
1316
+ len = RARRAY_LEN(v);
1317
+ tmp_tbl = ALLOCA_N(ID, len + 3);
1318
+ tmp_tbl[0] = (ID)(len + 2);
1319
+ tmp_tbl[1] = (ID)('_');
1320
+ tmp_tbl[2] = (ID)('~');
1321
+ for(j = 0; j < len; ++j)
1322
+ {
1323
+ VALUE e = RARRAY_PTR(v)[j];
1324
+ if(e == Qnil)
1325
+ {
1326
+ /* flip state */
1327
+ tmp_tbl[j + 3] = 0;
1328
+ }
1329
+ else
1330
+ {
1331
+ tmp_tbl[j + 3] = SYM2ID(e);
1332
+ }
1333
+ }
1334
+ n->nd_tbl = ALLOC_N(ID, len + 3);
1335
+ memcpy(n->nd_tbl, tmp_tbl, sizeof(ID) * (len + 3));
1336
+ }
1337
+ return;
1338
+ }
1339
+ case NEN_TVAL:
1340
+ {
1341
+ Check_Type(v, T_ARRAY);
1342
+ if(RARRAY_LEN(v) != 2)
1343
+ {
1344
+ rb_raise(rb_eArgError, "wrong size for array");
1345
+ }
1346
+ int flags = NUM2INT(RARRAY_PTR(v)[0]);
1347
+ switch(flags & T_MASK)
1348
+ {
1349
+ case T_CLASS:
1350
+ case T_MODULE:
1351
+ {
1352
+ VALUE str = RARRAY_PTR(v)[1];
1353
+ Check_Type(str, T_STRING);
1354
+ VALUE klass = rb_path2class(STR2CSTR(str));
1355
+ if(flags & FL_SINGLETON)
1356
+ {
1357
+ *(VALUE *)(&n->nd_tval) =
1358
+ rb_singleton_class(klass);
1359
+ }
1360
+ else
1361
+ {
1362
+ *(VALUE *)(&n->nd_tval) =
1363
+ klass;
1364
+ }
1365
+ break;
1366
+ }
1367
+ default:
1368
+ *(VALUE *)(&n->nd_tval) = RARRAY_PTR(v)[1];
1369
+ break;
1370
+ }
1371
+ return;
1372
+ }
1373
+ case NEN_VALUE:
1374
+ {
1375
+ if(v == Qnil)
1376
+ {
1377
+ n->nd_value = 0;
1378
+ }
1379
+ else
1380
+ {
1381
+ VALUE nid = rb_hash_aref(id_hash, v);
1382
+ if(RTEST(nid))
1383
+ {
1384
+ n->nd_value = id_to_node(nid);
1385
+ }
1386
+ else
1387
+ {
1388
+ n->u2.node = (NODE *)load_node_or_iseq_from_hash(
1389
+ v, node_hash, id_hash);
1390
+ }
1391
+ }
1392
+ return;
1393
+ }
1394
+ case NEN_VAR:
1395
+ {
1396
+ if(v == Qnil)
1397
+ {
1398
+ n->nd_var = 0;
1399
+ }
1400
+ else
1401
+ {
1402
+ VALUE nid = rb_hash_aref(id_hash, v);
1403
+ if(RTEST(nid))
1404
+ {
1405
+ n->nd_var = id_to_node(nid);
1406
+ }
1407
+ else
1408
+ {
1409
+ n->u1.node = (NODE *)load_node_or_iseq_from_hash(
1410
+ v, node_hash, id_hash);
1411
+ }
1412
+ }
1413
+ return;
1414
+ }
1415
+ case NEN_VID:
1416
+ {
1417
+ if(NIL_P(v))
1418
+ {
1419
+ n->nd_vid = 0;
1420
+ }
1421
+ else
1422
+ {
1423
+ n->nd_vid = SYM2ID(v);
1424
+ }
1425
+ return;
1426
+ }
1427
+ }
1428
+ rb_raise(rb_eRuntimeError, "Internal error: invalid Node_Elem_Name %d", nen);
1429
+ }
1430
+
1431
+ /*
1432
+ * Return the Node's _1st_ member. The return type is
1433
+ * either a Node or an Object.
1434
+ */
1435
+ static VALUE node_1st(VALUE self)
1436
+ {
1437
+ NODE * n;
1438
+ Data_Get_Struct(self, NODE, n);
1439
+
1440
+ if(TYPE(n->nd_1st) == T_NODE)
1441
+ {
1442
+ return wrap_node((NODE *)n->nd_1st);
1443
+ }
1444
+ else
1445
+ {
1446
+ return (VALUE)n->nd_1st;
1447
+ }
1448
+ }
1449
+ /*
1450
+ * Return the Node's _2nd_ member. The return type is
1451
+ * either a Node or an Object.
1452
+ */
1453
+ static VALUE node_2nd(VALUE self)
1454
+ {
1455
+ NODE * n;
1456
+ Data_Get_Struct(self, NODE, n);
1457
+
1458
+ if(TYPE(n->nd_2nd) == T_NODE)
1459
+ {
1460
+ return wrap_node((NODE *)n->nd_2nd);
1461
+ }
1462
+ else
1463
+ {
1464
+ return (VALUE)n->nd_2nd;
1465
+ }
1466
+ }
1467
+ /*
1468
+ * Return the Node's _alen_ member. The return type is an
1469
+ * Integer.
1470
+ */
1471
+ static VALUE node_alen(VALUE self)
1472
+ {
1473
+ NODE * n;
1474
+ Data_Get_Struct(self, NODE, n);
1475
+ return LONG2NUM(n->nd_alen);
1476
+ }
1477
+ /*
1478
+ * Return the Node's _argc_ member. The return type is an
1479
+ * Integer.
1480
+ */
1481
+ static VALUE node_argc(VALUE self)
1482
+ {
1483
+ NODE * n;
1484
+ Data_Get_Struct(self, NODE, n);
1485
+ return LONG2NUM(n->nd_argc);
1486
+ }
1487
+ /*
1488
+ * Return the Node's _args_ member. The return type is
1489
+ * either a Node or an Object.
1490
+ */
1491
+ static VALUE node_args(VALUE self)
1492
+ {
1493
+ NODE * n;
1494
+ Data_Get_Struct(self, NODE, n);
1495
+
1496
+ if(TYPE(n->nd_args) == T_NODE)
1497
+ {
1498
+ return wrap_node((NODE *)n->nd_args);
1499
+ }
1500
+ else
1501
+ {
1502
+ return (VALUE)n->nd_args;
1503
+ }
1504
+ }
1505
+ /*
1506
+ * Return the Node's _beg_ member. The return type is
1507
+ * either a Node or an Object.
1508
+ */
1509
+ static VALUE node_beg(VALUE self)
1510
+ {
1511
+ NODE * n;
1512
+ Data_Get_Struct(self, NODE, n);
1513
+
1514
+ if(TYPE(n->nd_beg) == T_NODE)
1515
+ {
1516
+ return wrap_node((NODE *)n->nd_beg);
1517
+ }
1518
+ else
1519
+ {
1520
+ return (VALUE)n->nd_beg;
1521
+ }
1522
+ }
1523
+ /*
1524
+ * Return the Node's _body_ member. The return type is
1525
+ * either a Node or an Object.
1526
+ */
1527
+ static VALUE node_body(VALUE self)
1528
+ {
1529
+ NODE * n;
1530
+ Data_Get_Struct(self, NODE, n);
1531
+
1532
+ if(TYPE(n->nd_body) == T_NODE)
1533
+ {
1534
+ return wrap_node((NODE *)n->nd_body);
1535
+ }
1536
+ else
1537
+ {
1538
+ return (VALUE)n->nd_body;
1539
+ }
1540
+ }
1541
+ /*
1542
+ * Return the Node's _cflag_ member. The return type is an
1543
+ * Integer.
1544
+ */
1545
+ static VALUE node_cflag(VALUE self)
1546
+ {
1547
+ NODE * n;
1548
+ Data_Get_Struct(self, NODE, n);
1549
+ return LONG2NUM(n->nd_cflag);
1550
+ }
1551
+ /*
1552
+ * Return the Node's _cfnc_ member. The return type is an
1553
+ * integer representation of the cfnc's pointer.
1554
+ */
1555
+ static VALUE node_cfnc(VALUE self)
1556
+ {
1557
+ NODE * n;
1558
+ Data_Get_Struct(self, NODE, n);
1559
+ return LONG2NUM((long)(n->nd_cfnc));
1560
+ }
1561
+ /*
1562
+ * Return the Node's _clss_ member. The return type is
1563
+ * either a Node or an Object.
1564
+ */
1565
+ static VALUE node_clss(VALUE self)
1566
+ {
1567
+ NODE * n;
1568
+ Data_Get_Struct(self, NODE, n);
1569
+
1570
+ if(TYPE(n->nd_clss) == T_NODE)
1571
+ {
1572
+ return wrap_node((NODE *)n->nd_clss);
1573
+ }
1574
+ else
1575
+ {
1576
+ return (VALUE)n->nd_clss;
1577
+ }
1578
+ }
1579
+ /*
1580
+ * Return the Node's _cnt_ member. The return type is an
1581
+ * Integer.
1582
+ */
1583
+ static VALUE node_cnt(VALUE self)
1584
+ {
1585
+ NODE * n;
1586
+ Data_Get_Struct(self, NODE, n);
1587
+ return LONG2NUM(n->nd_cnt);
1588
+ }
1589
+ /*
1590
+ * Return the Node's _cond_ member. The return type is
1591
+ * either a Node or an Object.
1592
+ */
1593
+ static VALUE node_cond(VALUE self)
1594
+ {
1595
+ NODE * n;
1596
+ Data_Get_Struct(self, NODE, n);
1597
+
1598
+ if(TYPE(n->nd_cond) == T_NODE)
1599
+ {
1600
+ return wrap_node((NODE *)n->nd_cond);
1601
+ }
1602
+ else
1603
+ {
1604
+ return (VALUE)n->nd_cond;
1605
+ }
1606
+ }
1607
+ /*
1608
+ * Return the Node's _cpath_ member. The return type is
1609
+ * either a Node or an Object.
1610
+ */
1611
+ static VALUE node_cpath(VALUE self)
1612
+ {
1613
+ NODE * n;
1614
+ Data_Get_Struct(self, NODE, n);
1615
+
1616
+ if(TYPE(n->nd_cpath) == T_NODE)
1617
+ {
1618
+ return wrap_node((NODE *)n->nd_cpath);
1619
+ }
1620
+ else
1621
+ {
1622
+ return (VALUE)n->nd_cpath;
1623
+ }
1624
+ }
1625
+ /*
1626
+ * Return the Node's _cval_ member. The return type is
1627
+ * either a Node or an Object.
1628
+ */
1629
+ static VALUE node_cval(VALUE self)
1630
+ {
1631
+ NODE * n;
1632
+ Data_Get_Struct(self, NODE, n);
1633
+
1634
+ if(TYPE(n->nd_cval) == T_NODE)
1635
+ {
1636
+ return wrap_node((NODE *)n->nd_cval);
1637
+ }
1638
+ else
1639
+ {
1640
+ return (VALUE)n->nd_cval;
1641
+ }
1642
+ }
1643
+ /*
1644
+ * Return the Node's _defn_ member. The return type is
1645
+ * either a Node or an Object.
1646
+ */
1647
+ static VALUE node_defn(VALUE self)
1648
+ {
1649
+ NODE * n;
1650
+ Data_Get_Struct(self, NODE, n);
1651
+
1652
+ if(TYPE(n->nd_defn) == T_NODE)
1653
+ {
1654
+ return wrap_node((NODE *)n->nd_defn);
1655
+ }
1656
+ else
1657
+ {
1658
+ return (VALUE)n->nd_defn;
1659
+ }
1660
+ }
1661
+ /*
1662
+ * Return the Node's _else_ member. The return type is
1663
+ * either a Node or an Object.
1664
+ */
1665
+ static VALUE node_else(VALUE self)
1666
+ {
1667
+ NODE * n;
1668
+ Data_Get_Struct(self, NODE, n);
1669
+
1670
+ if(TYPE(n->nd_else) == T_NODE)
1671
+ {
1672
+ return wrap_node((NODE *)n->nd_else);
1673
+ }
1674
+ else
1675
+ {
1676
+ return (VALUE)n->nd_else;
1677
+ }
1678
+ }
1679
+ /*
1680
+ * Return the Node's _end_ member. The return type is
1681
+ * either a Node or an Object.
1682
+ */
1683
+ static VALUE node_end(VALUE self)
1684
+ {
1685
+ NODE * n;
1686
+ Data_Get_Struct(self, NODE, n);
1687
+
1688
+ if(TYPE(n->nd_end) == T_NODE)
1689
+ {
1690
+ return wrap_node((NODE *)n->nd_end);
1691
+ }
1692
+ else
1693
+ {
1694
+ return (VALUE)n->nd_end;
1695
+ }
1696
+ }
1697
+ /*
1698
+ * Return the Node's _ensr_ member. The return type is
1699
+ * either a Node or an Object.
1700
+ */
1701
+ static VALUE node_ensr(VALUE self)
1702
+ {
1703
+ NODE * n;
1704
+ Data_Get_Struct(self, NODE, n);
1705
+
1706
+ if(TYPE(n->nd_ensr) == T_NODE)
1707
+ {
1708
+ return wrap_node((NODE *)n->nd_ensr);
1709
+ }
1710
+ else
1711
+ {
1712
+ return (VALUE)n->nd_ensr;
1713
+ }
1714
+ }
1715
+ /*
1716
+ * Return the Node's _entry_ member. The return type is
1717
+ * either a Node or an Object.
1718
+ */
1719
+ static VALUE node_entry(VALUE self)
1720
+ {
1721
+ NODE * n;
1722
+ Data_Get_Struct(self, NODE, n);
1723
+ if(n->nd_entry->id == 0)
1724
+ {
1725
+ rb_raise(
1726
+ rb_eRuntimeError,
1727
+ "Invalid ID for entry (node type %d)",
1728
+ nd_type(n));
1729
+ }
1730
+ return ID2SYM(n->nd_entry->id);
1731
+ }
1732
+ /*
1733
+ * Return the Node's _head_ member. The return type is
1734
+ * either a Node or an Object.
1735
+ */
1736
+ static VALUE node_head(VALUE self)
1737
+ {
1738
+ NODE * n;
1739
+ Data_Get_Struct(self, NODE, n);
1740
+
1741
+ if(TYPE(n->nd_head) == T_NODE)
1742
+ {
1743
+ return wrap_node((NODE *)n->nd_head);
1744
+ }
1745
+ else
1746
+ {
1747
+ return (VALUE)n->nd_head;
1748
+ }
1749
+ }
1750
+ /*
1751
+ * Return the Node's _iter_ member. The return type is
1752
+ * either a Node or an Object.
1753
+ */
1754
+ static VALUE node_iter(VALUE self)
1755
+ {
1756
+ NODE * n;
1757
+ Data_Get_Struct(self, NODE, n);
1758
+
1759
+ if(TYPE(n->nd_iter) == T_NODE)
1760
+ {
1761
+ return wrap_node((NODE *)n->nd_iter);
1762
+ }
1763
+ else
1764
+ {
1765
+ return (VALUE)n->nd_iter;
1766
+ }
1767
+ }
1768
+ /*
1769
+ * Return the Node's _lit_ member. The return type is
1770
+ * either a Node or an Object.
1771
+ */
1772
+ static VALUE node_lit(VALUE self)
1773
+ {
1774
+ NODE * n;
1775
+ Data_Get_Struct(self, NODE, n);
1776
+
1777
+ if(TYPE(n->nd_lit) == T_NODE)
1778
+ {
1779
+ return wrap_node((NODE *)n->nd_lit);
1780
+ }
1781
+ else
1782
+ {
1783
+ return (VALUE)n->nd_lit;
1784
+ }
1785
+ }
1786
+ /*
1787
+ * Return the Node's _mid_ member. The return type is a
1788
+ * Symbol.
1789
+ */
1790
+ static VALUE node_mid(VALUE self)
1791
+ {
1792
+ NODE * n;
1793
+ Data_Get_Struct(self, NODE, n);
1794
+ if(n->nd_mid == 0)
1795
+ {
1796
+ rb_raise(
1797
+ rb_eRuntimeError,
1798
+ "Invalid ID for mid (node type=%d)",
1799
+ nd_type(n));
1800
+ }
1801
+ return ID2SYM(n->nd_mid);
1802
+ }
1803
+ /*
1804
+ * Return the Node's _next_ member. The return type is
1805
+ * either a Node or an Object.
1806
+ */
1807
+ static VALUE node_next(VALUE self)
1808
+ {
1809
+ NODE * n;
1810
+ Data_Get_Struct(self, NODE, n);
1811
+
1812
+ if(TYPE(n->nd_next) == T_NODE)
1813
+ {
1814
+ return wrap_node((NODE *)n->nd_next);
1815
+ }
1816
+ else
1817
+ {
1818
+ return (VALUE)n->nd_next;
1819
+ }
1820
+ }
1821
+ /*
1822
+ * Return the Node's _noex_ member. The return type is an
1823
+ * Integer.
1824
+ */
1825
+ static VALUE node_noex(VALUE self)
1826
+ {
1827
+ NODE * n;
1828
+ Data_Get_Struct(self, NODE, n);
1829
+ return LONG2NUM(n->nd_noex);
1830
+ }
1831
+ /*
1832
+ * Return the Node's _nth_ member. The return type is an
1833
+ * Integer.
1834
+ */
1835
+ static VALUE node_nth(VALUE self)
1836
+ {
1837
+ NODE * n;
1838
+ Data_Get_Struct(self, NODE, n);
1839
+ return LONG2NUM(n->nd_nth);
1840
+ }
1841
+ /*
1842
+ * Return the Node's _opt_ member. The return type is
1843
+ * either a Node or an Object.
1844
+ */
1845
+ static VALUE node_opt(VALUE self)
1846
+ {
1847
+ NODE * n;
1848
+ Data_Get_Struct(self, NODE, n);
1849
+
1850
+ if(TYPE(n->nd_opt) == T_NODE)
1851
+ {
1852
+ return wrap_node((NODE *)n->nd_opt);
1853
+ }
1854
+ else
1855
+ {
1856
+ return (VALUE)n->nd_opt;
1857
+ }
1858
+ }
1859
+ /*
1860
+ * Return the Node's _orig_ member. The return type is
1861
+ * either a Node or an Object.
1862
+ */
1863
+ static VALUE node_orig(VALUE self)
1864
+ {
1865
+ NODE * n;
1866
+ Data_Get_Struct(self, NODE, n);
1867
+
1868
+ if(TYPE(n->nd_orig) == T_NODE)
1869
+ {
1870
+ return wrap_node((NODE *)n->nd_orig);
1871
+ }
1872
+ else
1873
+ {
1874
+ return (VALUE)n->nd_orig;
1875
+ }
1876
+ }
1877
+ /*
1878
+ * Return the Node's _recv_ member. The return type is
1879
+ * either a Node or an Object.
1880
+ */
1881
+ static VALUE node_recv(VALUE self)
1882
+ {
1883
+ NODE * n;
1884
+ Data_Get_Struct(self, NODE, n);
1885
+
1886
+ if(TYPE(n->nd_recv) == T_NODE)
1887
+ {
1888
+ return wrap_node((NODE *)n->nd_recv);
1889
+ }
1890
+ else
1891
+ {
1892
+ return (VALUE)n->nd_recv;
1893
+ }
1894
+ }
1895
+ /*
1896
+ * Return the Node's _resq_ member. The return type is
1897
+ * either a Node or an Object.
1898
+ */
1899
+ static VALUE node_resq(VALUE self)
1900
+ {
1901
+ NODE * n;
1902
+ Data_Get_Struct(self, NODE, n);
1903
+
1904
+ if(TYPE(n->nd_resq) == T_NODE)
1905
+ {
1906
+ return wrap_node((NODE *)n->nd_resq);
1907
+ }
1908
+ else
1909
+ {
1910
+ return (VALUE)n->nd_resq;
1911
+ }
1912
+ }
1913
+ /*
1914
+ * Return the Node's _rest_ member. The return type is
1915
+ * either a Node or an Object.
1916
+ */
1917
+ static VALUE node_rest(VALUE self)
1918
+ {
1919
+ NODE * n;
1920
+ Data_Get_Struct(self, NODE, n);
1921
+
1922
+ if(TYPE(n->nd_rest) == T_NODE)
1923
+ {
1924
+ return wrap_node((NODE *)n->nd_rest);
1925
+ }
1926
+ else
1927
+ {
1928
+ return (VALUE)n->nd_rest;
1929
+ }
1930
+ }
1931
+ /*
1932
+ * Return the Node's _rval_ member. The return type is
1933
+ * either a Node or an Object.
1934
+ */
1935
+ static VALUE node_rval(VALUE self)
1936
+ {
1937
+ NODE * n;
1938
+ Data_Get_Struct(self, NODE, n);
1939
+
1940
+ if(TYPE(n->nd_rval) == T_NODE)
1941
+ {
1942
+ return wrap_node((NODE *)n->nd_rval);
1943
+ }
1944
+ else
1945
+ {
1946
+ return (VALUE)n->nd_rval;
1947
+ }
1948
+ }
1949
+ /*
1950
+ * Return the Node's _state_ member. The return type is an
1951
+ * Integer.
1952
+ */
1953
+ static VALUE node_state(VALUE self)
1954
+ {
1955
+ NODE * n;
1956
+ Data_Get_Struct(self, NODE, n);
1957
+ return LONG2NUM(n->nd_state);
1958
+ }
1959
+ /*
1960
+ * Return the Node's _stts_ member. The return type is
1961
+ * either a Node or an Object.
1962
+ */
1963
+ static VALUE node_stts(VALUE self)
1964
+ {
1965
+ NODE * n;
1966
+ Data_Get_Struct(self, NODE, n);
1967
+
1968
+ if(TYPE(n->nd_stts) == T_NODE)
1969
+ {
1970
+ return wrap_node((NODE *)n->nd_stts);
1971
+ }
1972
+ else
1973
+ {
1974
+ return (VALUE)n->nd_stts;
1975
+ }
1976
+ }
1977
+ /*
1978
+ * Return the Node's _super_ member. The return type is
1979
+ * either a Node or an Object.
1980
+ */
1981
+ static VALUE node_super(VALUE self)
1982
+ {
1983
+ NODE * n;
1984
+ Data_Get_Struct(self, NODE, n);
1985
+
1986
+ if(TYPE(n->nd_super) == T_NODE)
1987
+ {
1988
+ return wrap_node((NODE *)n->nd_super);
1989
+ }
1990
+ else
1991
+ {
1992
+ return (VALUE)n->nd_super;
1993
+ }
1994
+ }
1995
+ /*
1996
+ * Return the Node's _tbl_ member. The return value is an
1997
+ * Array holding names of variables.
1998
+ */
1999
+ static VALUE node_tbl(VALUE self)
2000
+ {
2001
+ NODE * n;
2002
+ Data_Get_Struct(self, NODE, n);
2003
+ return variable_names(n->nd_tbl);
2004
+ }
2005
+ /*
2006
+ * Return the Node's _tval_ member. The return type is
2007
+ * either a Node or an Object.
2008
+ */
2009
+ static VALUE node_tval(VALUE self)
2010
+ {
2011
+ NODE * n;
2012
+ Data_Get_Struct(self, NODE, n);
2013
+
2014
+ if(TYPE(n->nd_tval) == T_NODE)
2015
+ {
2016
+ return wrap_node((NODE *)n->nd_tval);
2017
+ }
2018
+ else
2019
+ {
2020
+ return (VALUE)n->nd_tval;
2021
+ }
2022
+ }
2023
+ /*
2024
+ * Return the Node's _value_ member. The return type is
2025
+ * either a Node or an Object.
2026
+ */
2027
+ static VALUE node_value(VALUE self)
2028
+ {
2029
+ NODE * n;
2030
+ Data_Get_Struct(self, NODE, n);
2031
+
2032
+ if(TYPE(n->nd_value) == T_NODE)
2033
+ {
2034
+ return wrap_node((NODE *)n->nd_value);
2035
+ }
2036
+ else
2037
+ {
2038
+ return (VALUE)n->nd_value;
2039
+ }
2040
+ }
2041
+ /*
2042
+ * Return the Node's _var_ member. The return type is
2043
+ * either a Node or an Object.
2044
+ */
2045
+ static VALUE node_var(VALUE self)
2046
+ {
2047
+ NODE * n;
2048
+ Data_Get_Struct(self, NODE, n);
2049
+
2050
+ if(TYPE(n->nd_var) == T_NODE)
2051
+ {
2052
+ return wrap_node((NODE *)n->nd_var);
2053
+ }
2054
+ else
2055
+ {
2056
+ return (VALUE)n->nd_var;
2057
+ }
2058
+ }
2059
+ /*
2060
+ * Return the Node's _vid_ member. The return type is a
2061
+ * Symbol.
2062
+ */
2063
+ static VALUE node_vid(VALUE self)
2064
+ {
2065
+ NODE * n;
2066
+ Data_Get_Struct(self, NODE, n);
2067
+ if(n->nd_vid == 0)
2068
+ {
2069
+ rb_raise(
2070
+ rb_eRuntimeError,
2071
+ "Invalid ID for vid (node type=%d)",
2072
+ nd_type(n));
2073
+ }
2074
+ return ID2SYM(n->nd_vid);
2075
+ }
2076
+
2077
+ /*
2078
+ * Return an array of strings containing the names of the node class's
2079
+ * members.
2080
+ */
2081
+ VALUE node_s_members(VALUE klass)
2082
+ {
2083
+ return rb_iv_get(klass, "__member__");
2084
+ }
2085
+
2086
+ void define_node_subclass_methods()
2087
+ {
2088
+ /* For rdoc: rb_cNode = rb_define_class("Node", rb_cObject); */
2089
+ VALUE rb_cNode = rb_const_get(rb_cObject, rb_intern("Node"));
2090
+ VALUE members;
2091
+
2092
+ {
2093
+ VALUE rb_cBLOCK = rb_define_class_under(rb_cNode, "BLOCK", rb_cNode);
2094
+ members = rb_ary_new();
2095
+ rb_cNodeSubclass[NODE_BLOCK] = rb_cBLOCK;
2096
+ rb_iv_set(rb_cBLOCK, "__member__", members);
2097
+ rb_define_singleton_method(rb_cBLOCK, "members", node_s_members, 0);
2098
+ rb_define_method(rb_cBLOCK, "head", node_head, 0);
2099
+ rb_ary_push(members, rb_str_new2("head"));
2100
+ rb_define_method(rb_cBLOCK, "next", node_next, 0);
2101
+ rb_ary_push(members, rb_str_new2("next"));
2102
+ }
2103
+ {
2104
+ VALUE rb_cPOSTEXE = rb_define_class_under(rb_cNode, "POSTEXE", rb_cNode);
2105
+ members = rb_ary_new();
2106
+ rb_cNodeSubclass[NODE_POSTEXE] = rb_cPOSTEXE;
2107
+ rb_iv_set(rb_cPOSTEXE, "__member__", members);
2108
+ rb_define_singleton_method(rb_cPOSTEXE, "members", node_s_members, 0);
2109
+ }
2110
+ {
2111
+ VALUE rb_cBEGIN = rb_define_class_under(rb_cNode, "BEGIN", rb_cNode);
2112
+ members = rb_ary_new();
2113
+ rb_cNodeSubclass[NODE_BEGIN] = rb_cBEGIN;
2114
+ rb_iv_set(rb_cBEGIN, "__member__", members);
2115
+ rb_define_singleton_method(rb_cBEGIN, "members", node_s_members, 0);
2116
+ rb_define_method(rb_cBEGIN, "body", node_body, 0);
2117
+ rb_ary_push(members, rb_str_new2("body"));
2118
+ }
2119
+ {
2120
+ VALUE rb_cMATCH = rb_define_class_under(rb_cNode, "MATCH", rb_cNode);
2121
+ members = rb_ary_new();
2122
+ rb_cNodeSubclass[NODE_MATCH] = rb_cMATCH;
2123
+ rb_iv_set(rb_cMATCH, "__member__", members);
2124
+ rb_define_singleton_method(rb_cMATCH, "members", node_s_members, 0);
2125
+ rb_define_method(rb_cMATCH, "head", node_head, 0);
2126
+ rb_ary_push(members, rb_str_new2("head"));
2127
+ }
2128
+ {
2129
+ VALUE rb_cMATCH2 = rb_define_class_under(rb_cNode, "MATCH2", rb_cNode);
2130
+ members = rb_ary_new();
2131
+ rb_cNodeSubclass[NODE_MATCH2] = rb_cMATCH2;
2132
+ rb_iv_set(rb_cMATCH2, "__member__", members);
2133
+ rb_define_singleton_method(rb_cMATCH2, "members", node_s_members, 0);
2134
+ rb_define_method(rb_cMATCH2, "recv", node_recv, 0);
2135
+ rb_ary_push(members, rb_str_new2("recv"));
2136
+ rb_define_method(rb_cMATCH2, "value", node_value, 0);
2137
+ rb_ary_push(members, rb_str_new2("value"));
2138
+ }
2139
+ {
2140
+ VALUE rb_cMATCH3 = rb_define_class_under(rb_cNode, "MATCH3", rb_cNode);
2141
+ members = rb_ary_new();
2142
+ rb_cNodeSubclass[NODE_MATCH3] = rb_cMATCH3;
2143
+ rb_iv_set(rb_cMATCH3, "__member__", members);
2144
+ rb_define_singleton_method(rb_cMATCH3, "members", node_s_members, 0);
2145
+ rb_define_method(rb_cMATCH3, "recv", node_recv, 0);
2146
+ rb_ary_push(members, rb_str_new2("recv"));
2147
+ rb_define_method(rb_cMATCH3, "value", node_value, 0);
2148
+ rb_ary_push(members, rb_str_new2("value"));
2149
+ }
2150
+ {
2151
+ VALUE rb_cOPT_N = rb_define_class_under(rb_cNode, "OPT_N", rb_cNode);
2152
+ members = rb_ary_new();
2153
+ rb_cNodeSubclass[NODE_OPT_N] = rb_cOPT_N;
2154
+ rb_iv_set(rb_cOPT_N, "__member__", members);
2155
+ rb_define_singleton_method(rb_cOPT_N, "members", node_s_members, 0);
2156
+ rb_define_method(rb_cOPT_N, "body", node_body, 0);
2157
+ rb_ary_push(members, rb_str_new2("body"));
2158
+ }
2159
+ {
2160
+ VALUE rb_cSELF = rb_define_class_under(rb_cNode, "SELF", rb_cNode);
2161
+ members = rb_ary_new();
2162
+ rb_cNodeSubclass[NODE_SELF] = rb_cSELF;
2163
+ rb_iv_set(rb_cSELF, "__member__", members);
2164
+ rb_define_singleton_method(rb_cSELF, "members", node_s_members, 0);
2165
+ }
2166
+ {
2167
+ VALUE rb_cNILNODE = rb_define_class_under(rb_cNode, "NILNODE", rb_cNode);
2168
+ members = rb_ary_new();
2169
+ rb_cNodeSubclass[NODE_NIL] = rb_cNILNODE;
2170
+ rb_iv_set(rb_cNILNODE, "__member__", members);
2171
+ rb_define_singleton_method(rb_cNILNODE, "members", node_s_members, 0);
2172
+ }
2173
+ {
2174
+ VALUE rb_cTRUENODE = rb_define_class_under(rb_cNode, "TRUENODE", rb_cNode);
2175
+ members = rb_ary_new();
2176
+ rb_cNodeSubclass[NODE_TRUE] = rb_cTRUENODE;
2177
+ rb_iv_set(rb_cTRUENODE, "__member__", members);
2178
+ rb_define_singleton_method(rb_cTRUENODE, "members", node_s_members, 0);
2179
+ }
2180
+ {
2181
+ VALUE rb_cFALSENODE = rb_define_class_under(rb_cNode, "FALSENODE", rb_cNode);
2182
+ members = rb_ary_new();
2183
+ rb_cNodeSubclass[NODE_FALSE] = rb_cFALSENODE;
2184
+ rb_iv_set(rb_cFALSENODE, "__member__", members);
2185
+ rb_define_singleton_method(rb_cFALSENODE, "members", node_s_members, 0);
2186
+ }
2187
+ {
2188
+ VALUE rb_cIF = rb_define_class_under(rb_cNode, "IF", rb_cNode);
2189
+ members = rb_ary_new();
2190
+ rb_cNodeSubclass[NODE_IF] = rb_cIF;
2191
+ rb_iv_set(rb_cIF, "__member__", members);
2192
+ rb_define_singleton_method(rb_cIF, "members", node_s_members, 0);
2193
+ rb_define_method(rb_cIF, "body", node_body, 0);
2194
+ rb_ary_push(members, rb_str_new2("body"));
2195
+ rb_define_method(rb_cIF, "else", node_else, 0);
2196
+ rb_ary_push(members, rb_str_new2("else"));
2197
+ rb_define_method(rb_cIF, "cond", node_cond, 0);
2198
+ rb_ary_push(members, rb_str_new2("cond"));
2199
+ }
2200
+ {
2201
+ VALUE rb_cWHEN = rb_define_class_under(rb_cNode, "WHEN", rb_cNode);
2202
+ members = rb_ary_new();
2203
+ rb_cNodeSubclass[NODE_WHEN] = rb_cWHEN;
2204
+ rb_iv_set(rb_cWHEN, "__member__", members);
2205
+ rb_define_singleton_method(rb_cWHEN, "members", node_s_members, 0);
2206
+ rb_define_method(rb_cWHEN, "head", node_head, 0);
2207
+ rb_ary_push(members, rb_str_new2("head"));
2208
+ rb_define_method(rb_cWHEN, "body", node_body, 0);
2209
+ rb_ary_push(members, rb_str_new2("body"));
2210
+ rb_define_method(rb_cWHEN, "next", node_next, 0);
2211
+ rb_ary_push(members, rb_str_new2("next"));
2212
+ }
2213
+ {
2214
+ VALUE rb_cCASE = rb_define_class_under(rb_cNode, "CASE", rb_cNode);
2215
+ members = rb_ary_new();
2216
+ rb_cNodeSubclass[NODE_CASE] = rb_cCASE;
2217
+ rb_iv_set(rb_cCASE, "__member__", members);
2218
+ rb_define_singleton_method(rb_cCASE, "members", node_s_members, 0);
2219
+ rb_define_method(rb_cCASE, "head", node_head, 0);
2220
+ rb_ary_push(members, rb_str_new2("head"));
2221
+ rb_define_method(rb_cCASE, "body", node_body, 0);
2222
+ rb_ary_push(members, rb_str_new2("body"));
2223
+ rb_define_method(rb_cCASE, "next", node_next, 0);
2224
+ rb_ary_push(members, rb_str_new2("next"));
2225
+ }
2226
+ {
2227
+ VALUE rb_cWHILE = rb_define_class_under(rb_cNode, "WHILE", rb_cNode);
2228
+ members = rb_ary_new();
2229
+ rb_cNodeSubclass[NODE_WHILE] = rb_cWHILE;
2230
+ rb_iv_set(rb_cWHILE, "__member__", members);
2231
+ rb_define_singleton_method(rb_cWHILE, "members", node_s_members, 0);
2232
+ rb_define_method(rb_cWHILE, "cond", node_cond, 0);
2233
+ rb_ary_push(members, rb_str_new2("cond"));
2234
+ rb_define_method(rb_cWHILE, "body", node_body, 0);
2235
+ rb_ary_push(members, rb_str_new2("body"));
2236
+ rb_define_method(rb_cWHILE, "state", node_state, 0);
2237
+ rb_ary_push(members, rb_str_new2("state"));
2238
+ }
2239
+ {
2240
+ VALUE rb_cUNTIL = rb_define_class_under(rb_cNode, "UNTIL", rb_cNode);
2241
+ members = rb_ary_new();
2242
+ rb_cNodeSubclass[NODE_UNTIL] = rb_cUNTIL;
2243
+ rb_iv_set(rb_cUNTIL, "__member__", members);
2244
+ rb_define_singleton_method(rb_cUNTIL, "members", node_s_members, 0);
2245
+ rb_define_method(rb_cUNTIL, "cond", node_cond, 0);
2246
+ rb_ary_push(members, rb_str_new2("cond"));
2247
+ rb_define_method(rb_cUNTIL, "body", node_body, 0);
2248
+ rb_ary_push(members, rb_str_new2("body"));
2249
+ rb_define_method(rb_cUNTIL, "state", node_state, 0);
2250
+ rb_ary_push(members, rb_str_new2("state"));
2251
+ }
2252
+ {
2253
+ VALUE rb_cBLOCK_PASS = rb_define_class_under(rb_cNode, "BLOCK_PASS", rb_cNode);
2254
+ members = rb_ary_new();
2255
+ rb_cNodeSubclass[NODE_BLOCK_PASS] = rb_cBLOCK_PASS;
2256
+ rb_iv_set(rb_cBLOCK_PASS, "__member__", members);
2257
+ rb_define_singleton_method(rb_cBLOCK_PASS, "members", node_s_members, 0);
2258
+ rb_define_method(rb_cBLOCK_PASS, "body", node_body, 0);
2259
+ rb_ary_push(members, rb_str_new2("body"));
2260
+ rb_define_method(rb_cBLOCK_PASS, "iter", node_iter, 0);
2261
+ rb_ary_push(members, rb_str_new2("iter"));
2262
+ }
2263
+ {
2264
+ VALUE rb_cITER = rb_define_class_under(rb_cNode, "ITER", rb_cNode);
2265
+ members = rb_ary_new();
2266
+ rb_cNodeSubclass[NODE_ITER] = rb_cITER;
2267
+ rb_iv_set(rb_cITER, "__member__", members);
2268
+ rb_define_singleton_method(rb_cITER, "members", node_s_members, 0);
2269
+ rb_define_method(rb_cITER, "var", node_var, 0);
2270
+ rb_ary_push(members, rb_str_new2("var"));
2271
+ rb_define_method(rb_cITER, "body", node_body, 0);
2272
+ rb_ary_push(members, rb_str_new2("body"));
2273
+ rb_define_method(rb_cITER, "iter", node_iter, 0);
2274
+ rb_ary_push(members, rb_str_new2("iter"));
2275
+ }
2276
+ {
2277
+ VALUE rb_cFOR = rb_define_class_under(rb_cNode, "FOR", rb_cNode);
2278
+ members = rb_ary_new();
2279
+ rb_cNodeSubclass[NODE_FOR] = rb_cFOR;
2280
+ rb_iv_set(rb_cFOR, "__member__", members);
2281
+ rb_define_singleton_method(rb_cFOR, "members", node_s_members, 0);
2282
+ rb_define_method(rb_cFOR, "var", node_var, 0);
2283
+ rb_ary_push(members, rb_str_new2("var"));
2284
+ rb_define_method(rb_cFOR, "body", node_body, 0);
2285
+ rb_ary_push(members, rb_str_new2("body"));
2286
+ rb_define_method(rb_cFOR, "iter", node_iter, 0);
2287
+ rb_ary_push(members, rb_str_new2("iter"));
2288
+ }
2289
+ {
2290
+ VALUE rb_cBREAK = rb_define_class_under(rb_cNode, "BREAK", rb_cNode);
2291
+ members = rb_ary_new();
2292
+ rb_cNodeSubclass[NODE_BREAK] = rb_cBREAK;
2293
+ rb_iv_set(rb_cBREAK, "__member__", members);
2294
+ rb_define_singleton_method(rb_cBREAK, "members", node_s_members, 0);
2295
+ rb_define_method(rb_cBREAK, "stts", node_stts, 0);
2296
+ rb_ary_push(members, rb_str_new2("stts"));
2297
+ }
2298
+ {
2299
+ VALUE rb_cNEXT = rb_define_class_under(rb_cNode, "NEXT", rb_cNode);
2300
+ members = rb_ary_new();
2301
+ rb_cNodeSubclass[NODE_NEXT] = rb_cNEXT;
2302
+ rb_iv_set(rb_cNEXT, "__member__", members);
2303
+ rb_define_singleton_method(rb_cNEXT, "members", node_s_members, 0);
2304
+ rb_define_method(rb_cNEXT, "stts", node_stts, 0);
2305
+ rb_ary_push(members, rb_str_new2("stts"));
2306
+ }
2307
+ {
2308
+ VALUE rb_cREDO = rb_define_class_under(rb_cNode, "REDO", rb_cNode);
2309
+ members = rb_ary_new();
2310
+ rb_cNodeSubclass[NODE_REDO] = rb_cREDO;
2311
+ rb_iv_set(rb_cREDO, "__member__", members);
2312
+ rb_define_singleton_method(rb_cREDO, "members", node_s_members, 0);
2313
+ }
2314
+ {
2315
+ VALUE rb_cRETRY = rb_define_class_under(rb_cNode, "RETRY", rb_cNode);
2316
+ members = rb_ary_new();
2317
+ rb_cNodeSubclass[NODE_RETRY] = rb_cRETRY;
2318
+ rb_iv_set(rb_cRETRY, "__member__", members);
2319
+ rb_define_singleton_method(rb_cRETRY, "members", node_s_members, 0);
2320
+ }
2321
+ {
2322
+ VALUE rb_cYIELD = rb_define_class_under(rb_cNode, "YIELD", rb_cNode);
2323
+ members = rb_ary_new();
2324
+ rb_cNodeSubclass[NODE_YIELD] = rb_cYIELD;
2325
+ rb_iv_set(rb_cYIELD, "__member__", members);
2326
+ rb_define_singleton_method(rb_cYIELD, "members", node_s_members, 0);
2327
+ rb_define_method(rb_cYIELD, "stts", node_stts, 0);
2328
+ rb_ary_push(members, rb_str_new2("stts"));
2329
+ }
2330
+ {
2331
+ VALUE rb_cRESCUE = rb_define_class_under(rb_cNode, "RESCUE", rb_cNode);
2332
+ members = rb_ary_new();
2333
+ rb_cNodeSubclass[NODE_RESCUE] = rb_cRESCUE;
2334
+ rb_iv_set(rb_cRESCUE, "__member__", members);
2335
+ rb_define_singleton_method(rb_cRESCUE, "members", node_s_members, 0);
2336
+ rb_define_method(rb_cRESCUE, "head", node_head, 0);
2337
+ rb_ary_push(members, rb_str_new2("head"));
2338
+ rb_define_method(rb_cRESCUE, "resq", node_resq, 0);
2339
+ rb_ary_push(members, rb_str_new2("resq"));
2340
+ rb_define_method(rb_cRESCUE, "else", node_else, 0);
2341
+ rb_ary_push(members, rb_str_new2("else"));
2342
+ }
2343
+ {
2344
+ VALUE rb_cRESBODY = rb_define_class_under(rb_cNode, "RESBODY", rb_cNode);
2345
+ members = rb_ary_new();
2346
+ rb_cNodeSubclass[NODE_RESBODY] = rb_cRESBODY;
2347
+ rb_iv_set(rb_cRESBODY, "__member__", members);
2348
+ rb_define_singleton_method(rb_cRESBODY, "members", node_s_members, 0);
2349
+ rb_define_method(rb_cRESBODY, "head", node_head, 0);
2350
+ rb_ary_push(members, rb_str_new2("head"));
2351
+ rb_define_method(rb_cRESBODY, "resq", node_resq, 0);
2352
+ rb_ary_push(members, rb_str_new2("resq"));
2353
+ rb_define_method(rb_cRESBODY, "ensr", node_ensr, 0);
2354
+ rb_ary_push(members, rb_str_new2("ensr"));
2355
+ }
2356
+ {
2357
+ VALUE rb_cENSURE = rb_define_class_under(rb_cNode, "ENSURE", rb_cNode);
2358
+ members = rb_ary_new();
2359
+ rb_cNodeSubclass[NODE_ENSURE] = rb_cENSURE;
2360
+ rb_iv_set(rb_cENSURE, "__member__", members);
2361
+ rb_define_singleton_method(rb_cENSURE, "members", node_s_members, 0);
2362
+ rb_define_method(rb_cENSURE, "head", node_head, 0);
2363
+ rb_ary_push(members, rb_str_new2("head"));
2364
+ rb_define_method(rb_cENSURE, "ensr", node_ensr, 0);
2365
+ rb_ary_push(members, rb_str_new2("ensr"));
2366
+ }
2367
+ {
2368
+ VALUE rb_cAND = rb_define_class_under(rb_cNode, "AND", rb_cNode);
2369
+ members = rb_ary_new();
2370
+ rb_cNodeSubclass[NODE_AND] = rb_cAND;
2371
+ rb_iv_set(rb_cAND, "__member__", members);
2372
+ rb_define_singleton_method(rb_cAND, "members", node_s_members, 0);
2373
+ rb_define_method(rb_cAND, "first", node_1st, 0);
2374
+ rb_ary_push(members, rb_str_new2("first"));
2375
+ rb_define_method(rb_cAND, "second", node_2nd, 0);
2376
+ rb_ary_push(members, rb_str_new2("second"));
2377
+ }
2378
+ {
2379
+ VALUE rb_cOR = rb_define_class_under(rb_cNode, "OR", rb_cNode);
2380
+ members = rb_ary_new();
2381
+ rb_cNodeSubclass[NODE_OR] = rb_cOR;
2382
+ rb_iv_set(rb_cOR, "__member__", members);
2383
+ rb_define_singleton_method(rb_cOR, "members", node_s_members, 0);
2384
+ rb_define_method(rb_cOR, "first", node_1st, 0);
2385
+ rb_ary_push(members, rb_str_new2("first"));
2386
+ rb_define_method(rb_cOR, "second", node_2nd, 0);
2387
+ rb_ary_push(members, rb_str_new2("second"));
2388
+ }
2389
+ {
2390
+ VALUE rb_cNOT = rb_define_class_under(rb_cNode, "NOT", rb_cNode);
2391
+ members = rb_ary_new();
2392
+ rb_cNodeSubclass[NODE_NOT] = rb_cNOT;
2393
+ rb_iv_set(rb_cNOT, "__member__", members);
2394
+ rb_define_singleton_method(rb_cNOT, "members", node_s_members, 0);
2395
+ rb_define_method(rb_cNOT, "body", node_body, 0);
2396
+ rb_ary_push(members, rb_str_new2("body"));
2397
+ }
2398
+ {
2399
+ VALUE rb_cDOT2 = rb_define_class_under(rb_cNode, "DOT2", rb_cNode);
2400
+ members = rb_ary_new();
2401
+ rb_cNodeSubclass[NODE_DOT2] = rb_cDOT2;
2402
+ rb_iv_set(rb_cDOT2, "__member__", members);
2403
+ rb_define_singleton_method(rb_cDOT2, "members", node_s_members, 0);
2404
+ rb_define_method(rb_cDOT2, "beg", node_beg, 0);
2405
+ rb_ary_push(members, rb_str_new2("beg"));
2406
+ rb_define_method(rb_cDOT2, "end", node_end, 0);
2407
+ rb_ary_push(members, rb_str_new2("end"));
2408
+ rb_define_method(rb_cDOT2, "state", node_state, 0);
2409
+ rb_ary_push(members, rb_str_new2("state"));
2410
+ }
2411
+ {
2412
+ VALUE rb_cDOT3 = rb_define_class_under(rb_cNode, "DOT3", rb_cNode);
2413
+ members = rb_ary_new();
2414
+ rb_cNodeSubclass[NODE_DOT3] = rb_cDOT3;
2415
+ rb_iv_set(rb_cDOT3, "__member__", members);
2416
+ rb_define_singleton_method(rb_cDOT3, "members", node_s_members, 0);
2417
+ rb_define_method(rb_cDOT3, "beg", node_beg, 0);
2418
+ rb_ary_push(members, rb_str_new2("beg"));
2419
+ rb_define_method(rb_cDOT3, "end", node_end, 0);
2420
+ rb_ary_push(members, rb_str_new2("end"));
2421
+ rb_define_method(rb_cDOT3, "state", node_state, 0);
2422
+ rb_ary_push(members, rb_str_new2("state"));
2423
+ }
2424
+ {
2425
+ VALUE rb_cFLIP2 = rb_define_class_under(rb_cNode, "FLIP2", rb_cNode);
2426
+ members = rb_ary_new();
2427
+ rb_cNodeSubclass[NODE_FLIP2] = rb_cFLIP2;
2428
+ rb_iv_set(rb_cFLIP2, "__member__", members);
2429
+ rb_define_singleton_method(rb_cFLIP2, "members", node_s_members, 0);
2430
+ rb_define_method(rb_cFLIP2, "cnt", node_cnt, 0);
2431
+ rb_ary_push(members, rb_str_new2("cnt"));
2432
+ rb_define_method(rb_cFLIP2, "beg", node_beg, 0);
2433
+ rb_ary_push(members, rb_str_new2("beg"));
2434
+ rb_define_method(rb_cFLIP2, "end", node_end, 0);
2435
+ rb_ary_push(members, rb_str_new2("end"));
2436
+ }
2437
+ {
2438
+ VALUE rb_cFLIP3 = rb_define_class_under(rb_cNode, "FLIP3", rb_cNode);
2439
+ members = rb_ary_new();
2440
+ rb_cNodeSubclass[NODE_FLIP3] = rb_cFLIP3;
2441
+ rb_iv_set(rb_cFLIP3, "__member__", members);
2442
+ rb_define_singleton_method(rb_cFLIP3, "members", node_s_members, 0);
2443
+ rb_define_method(rb_cFLIP3, "cnt", node_cnt, 0);
2444
+ rb_ary_push(members, rb_str_new2("cnt"));
2445
+ rb_define_method(rb_cFLIP3, "beg", node_beg, 0);
2446
+ rb_ary_push(members, rb_str_new2("beg"));
2447
+ rb_define_method(rb_cFLIP3, "end", node_end, 0);
2448
+ rb_ary_push(members, rb_str_new2("end"));
2449
+ }
2450
+ {
2451
+ VALUE rb_cRETURN = rb_define_class_under(rb_cNode, "RETURN", rb_cNode);
2452
+ members = rb_ary_new();
2453
+ rb_cNodeSubclass[NODE_RETURN] = rb_cRETURN;
2454
+ rb_iv_set(rb_cRETURN, "__member__", members);
2455
+ rb_define_singleton_method(rb_cRETURN, "members", node_s_members, 0);
2456
+ rb_define_method(rb_cRETURN, "stts", node_stts, 0);
2457
+ rb_ary_push(members, rb_str_new2("stts"));
2458
+ }
2459
+ {
2460
+ VALUE rb_cARGS = rb_define_class_under(rb_cNode, "ARGS", rb_cNode);
2461
+ members = rb_ary_new();
2462
+ rb_cNodeSubclass[NODE_ARGS] = rb_cARGS;
2463
+ rb_iv_set(rb_cARGS, "__member__", members);
2464
+ rb_define_singleton_method(rb_cARGS, "members", node_s_members, 0);
2465
+ rb_define_method(rb_cARGS, "cnt", node_cnt, 0);
2466
+ rb_ary_push(members, rb_str_new2("cnt"));
2467
+ rb_define_method(rb_cARGS, "rest", node_rest, 0);
2468
+ rb_ary_push(members, rb_str_new2("rest"));
2469
+ rb_define_method(rb_cARGS, "opt", node_opt, 0);
2470
+ rb_ary_push(members, rb_str_new2("opt"));
2471
+ }
2472
+ {
2473
+ VALUE rb_cARGSCAT = rb_define_class_under(rb_cNode, "ARGSCAT", rb_cNode);
2474
+ members = rb_ary_new();
2475
+ rb_cNodeSubclass[NODE_ARGSCAT] = rb_cARGSCAT;
2476
+ rb_iv_set(rb_cARGSCAT, "__member__", members);
2477
+ rb_define_singleton_method(rb_cARGSCAT, "members", node_s_members, 0);
2478
+ rb_define_method(rb_cARGSCAT, "head", node_head, 0);
2479
+ rb_ary_push(members, rb_str_new2("head"));
2480
+ rb_define_method(rb_cARGSCAT, "body", node_body, 0);
2481
+ rb_ary_push(members, rb_str_new2("body"));
2482
+ }
2483
+ {
2484
+ VALUE rb_cARGSPUSH = rb_define_class_under(rb_cNode, "ARGSPUSH", rb_cNode);
2485
+ members = rb_ary_new();
2486
+ rb_cNodeSubclass[NODE_ARGSPUSH] = rb_cARGSPUSH;
2487
+ rb_iv_set(rb_cARGSPUSH, "__member__", members);
2488
+ rb_define_singleton_method(rb_cARGSPUSH, "members", node_s_members, 0);
2489
+ rb_define_method(rb_cARGSPUSH, "head", node_head, 0);
2490
+ rb_ary_push(members, rb_str_new2("head"));
2491
+ rb_define_method(rb_cARGSPUSH, "body", node_body, 0);
2492
+ rb_ary_push(members, rb_str_new2("body"));
2493
+ }
2494
+ {
2495
+ VALUE rb_cCALL = rb_define_class_under(rb_cNode, "CALL", rb_cNode);
2496
+ members = rb_ary_new();
2497
+ rb_cNodeSubclass[NODE_CALL] = rb_cCALL;
2498
+ rb_iv_set(rb_cCALL, "__member__", members);
2499
+ rb_define_singleton_method(rb_cCALL, "members", node_s_members, 0);
2500
+ rb_define_method(rb_cCALL, "recv", node_recv, 0);
2501
+ rb_ary_push(members, rb_str_new2("recv"));
2502
+ rb_define_method(rb_cCALL, "args", node_args, 0);
2503
+ rb_ary_push(members, rb_str_new2("args"));
2504
+ rb_define_method(rb_cCALL, "mid", node_mid, 0);
2505
+ rb_ary_push(members, rb_str_new2("mid"));
2506
+ }
2507
+ {
2508
+ VALUE rb_cFCALL = rb_define_class_under(rb_cNode, "FCALL", rb_cNode);
2509
+ members = rb_ary_new();
2510
+ rb_cNodeSubclass[NODE_FCALL] = rb_cFCALL;
2511
+ rb_iv_set(rb_cFCALL, "__member__", members);
2512
+ rb_define_singleton_method(rb_cFCALL, "members", node_s_members, 0);
2513
+ rb_define_method(rb_cFCALL, "args", node_args, 0);
2514
+ rb_ary_push(members, rb_str_new2("args"));
2515
+ rb_define_method(rb_cFCALL, "mid", node_mid, 0);
2516
+ rb_ary_push(members, rb_str_new2("mid"));
2517
+ }
2518
+ {
2519
+ VALUE rb_cVCALL = rb_define_class_under(rb_cNode, "VCALL", rb_cNode);
2520
+ members = rb_ary_new();
2521
+ rb_cNodeSubclass[NODE_VCALL] = rb_cVCALL;
2522
+ rb_iv_set(rb_cVCALL, "__member__", members);
2523
+ rb_define_singleton_method(rb_cVCALL, "members", node_s_members, 0);
2524
+ rb_define_method(rb_cVCALL, "mid", node_mid, 0);
2525
+ rb_ary_push(members, rb_str_new2("mid"));
2526
+ }
2527
+ {
2528
+ VALUE rb_cSUPER = rb_define_class_under(rb_cNode, "SUPER", rb_cNode);
2529
+ members = rb_ary_new();
2530
+ rb_cNodeSubclass[NODE_SUPER] = rb_cSUPER;
2531
+ rb_iv_set(rb_cSUPER, "__member__", members);
2532
+ rb_define_singleton_method(rb_cSUPER, "members", node_s_members, 0);
2533
+ rb_define_method(rb_cSUPER, "args", node_args, 0);
2534
+ rb_ary_push(members, rb_str_new2("args"));
2535
+ }
2536
+ {
2537
+ VALUE rb_cZSUPER = rb_define_class_under(rb_cNode, "ZSUPER", rb_cNode);
2538
+ members = rb_ary_new();
2539
+ rb_cNodeSubclass[NODE_ZSUPER] = rb_cZSUPER;
2540
+ rb_iv_set(rb_cZSUPER, "__member__", members);
2541
+ rb_define_singleton_method(rb_cZSUPER, "members", node_s_members, 0);
2542
+ rb_define_method(rb_cZSUPER, "args", node_args, 0);
2543
+ rb_ary_push(members, rb_str_new2("args"));
2544
+ }
2545
+ {
2546
+ VALUE rb_cSCOPE = rb_define_class_under(rb_cNode, "SCOPE", rb_cNode);
2547
+ members = rb_ary_new();
2548
+ rb_cNodeSubclass[NODE_SCOPE] = rb_cSCOPE;
2549
+ rb_iv_set(rb_cSCOPE, "__member__", members);
2550
+ rb_define_singleton_method(rb_cSCOPE, "members", node_s_members, 0);
2551
+ rb_define_method(rb_cSCOPE, "rval", node_rval, 0);
2552
+ rb_ary_push(members, rb_str_new2("rval"));
2553
+ rb_define_method(rb_cSCOPE, "tbl", node_tbl, 0);
2554
+ rb_ary_push(members, rb_str_new2("tbl"));
2555
+ rb_define_method(rb_cSCOPE, "next", node_next, 0);
2556
+ rb_ary_push(members, rb_str_new2("next"));
2557
+ }
2558
+ {
2559
+ VALUE rb_cOP_ASGN1 = rb_define_class_under(rb_cNode, "OP_ASGN1", rb_cNode);
2560
+ members = rb_ary_new();
2561
+ rb_cNodeSubclass[NODE_OP_ASGN1] = rb_cOP_ASGN1;
2562
+ rb_iv_set(rb_cOP_ASGN1, "__member__", members);
2563
+ rb_define_singleton_method(rb_cOP_ASGN1, "members", node_s_members, 0);
2564
+ rb_define_method(rb_cOP_ASGN1, "recv", node_recv, 0);
2565
+ rb_ary_push(members, rb_str_new2("recv"));
2566
+ rb_define_method(rb_cOP_ASGN1, "args", node_args, 0);
2567
+ rb_ary_push(members, rb_str_new2("args"));
2568
+ rb_define_method(rb_cOP_ASGN1, "mid", node_mid, 0);
2569
+ rb_ary_push(members, rb_str_new2("mid"));
2570
+ }
2571
+ {
2572
+ VALUE rb_cOP_ASGN2 = rb_define_class_under(rb_cNode, "OP_ASGN2", rb_cNode);
2573
+ members = rb_ary_new();
2574
+ rb_cNodeSubclass[NODE_OP_ASGN2] = rb_cOP_ASGN2;
2575
+ rb_iv_set(rb_cOP_ASGN2, "__member__", members);
2576
+ rb_define_singleton_method(rb_cOP_ASGN2, "members", node_s_members, 0);
2577
+ rb_define_method(rb_cOP_ASGN2, "vid", node_vid, 0);
2578
+ rb_ary_push(members, rb_str_new2("vid"));
2579
+ rb_define_method(rb_cOP_ASGN2, "recv", node_recv, 0);
2580
+ rb_ary_push(members, rb_str_new2("recv"));
2581
+ rb_define_method(rb_cOP_ASGN2, "value", node_value, 0);
2582
+ rb_ary_push(members, rb_str_new2("value"));
2583
+ }
2584
+ {
2585
+ VALUE rb_cOP_ASGN_AND = rb_define_class_under(rb_cNode, "OP_ASGN_AND", rb_cNode);
2586
+ members = rb_ary_new();
2587
+ rb_cNodeSubclass[NODE_OP_ASGN_AND] = rb_cOP_ASGN_AND;
2588
+ rb_iv_set(rb_cOP_ASGN_AND, "__member__", members);
2589
+ rb_define_singleton_method(rb_cOP_ASGN_AND, "members", node_s_members, 0);
2590
+ rb_define_method(rb_cOP_ASGN_AND, "head", node_head, 0);
2591
+ rb_ary_push(members, rb_str_new2("head"));
2592
+ rb_define_method(rb_cOP_ASGN_AND, "value", node_value, 0);
2593
+ rb_ary_push(members, rb_str_new2("value"));
2594
+ }
2595
+ {
2596
+ VALUE rb_cOP_ASGN_OR = rb_define_class_under(rb_cNode, "OP_ASGN_OR", rb_cNode);
2597
+ members = rb_ary_new();
2598
+ rb_cNodeSubclass[NODE_OP_ASGN_OR] = rb_cOP_ASGN_OR;
2599
+ rb_iv_set(rb_cOP_ASGN_OR, "__member__", members);
2600
+ rb_define_singleton_method(rb_cOP_ASGN_OR, "members", node_s_members, 0);
2601
+ rb_define_method(rb_cOP_ASGN_OR, "head", node_head, 0);
2602
+ rb_ary_push(members, rb_str_new2("head"));
2603
+ rb_define_method(rb_cOP_ASGN_OR, "value", node_value, 0);
2604
+ rb_ary_push(members, rb_str_new2("value"));
2605
+ }
2606
+ {
2607
+ VALUE rb_cMASGN = rb_define_class_under(rb_cNode, "MASGN", rb_cNode);
2608
+ members = rb_ary_new();
2609
+ rb_cNodeSubclass[NODE_MASGN] = rb_cMASGN;
2610
+ rb_iv_set(rb_cMASGN, "__member__", members);
2611
+ rb_define_singleton_method(rb_cMASGN, "members", node_s_members, 0);
2612
+ rb_define_method(rb_cMASGN, "value", node_value, 0);
2613
+ rb_ary_push(members, rb_str_new2("value"));
2614
+ rb_define_method(rb_cMASGN, "head", node_head, 0);
2615
+ rb_ary_push(members, rb_str_new2("head"));
2616
+ rb_define_method(rb_cMASGN, "args", node_args, 0);
2617
+ rb_ary_push(members, rb_str_new2("args"));
2618
+ }
2619
+ {
2620
+ VALUE rb_cLASGN = rb_define_class_under(rb_cNode, "LASGN", rb_cNode);
2621
+ members = rb_ary_new();
2622
+ rb_cNodeSubclass[NODE_LASGN] = rb_cLASGN;
2623
+ rb_iv_set(rb_cLASGN, "__member__", members);
2624
+ rb_define_singleton_method(rb_cLASGN, "members", node_s_members, 0);
2625
+ rb_define_method(rb_cLASGN, "vid", node_vid, 0);
2626
+ rb_ary_push(members, rb_str_new2("vid"));
2627
+ rb_define_method(rb_cLASGN, "value", node_value, 0);
2628
+ rb_ary_push(members, rb_str_new2("value"));
2629
+ rb_define_method(rb_cLASGN, "cnt", node_cnt, 0);
2630
+ rb_ary_push(members, rb_str_new2("cnt"));
2631
+ }
2632
+ {
2633
+ VALUE rb_cDASGN = rb_define_class_under(rb_cNode, "DASGN", rb_cNode);
2634
+ members = rb_ary_new();
2635
+ rb_cNodeSubclass[NODE_DASGN] = rb_cDASGN;
2636
+ rb_iv_set(rb_cDASGN, "__member__", members);
2637
+ rb_define_singleton_method(rb_cDASGN, "members", node_s_members, 0);
2638
+ rb_define_method(rb_cDASGN, "value", node_value, 0);
2639
+ rb_ary_push(members, rb_str_new2("value"));
2640
+ rb_define_method(rb_cDASGN, "vid", node_vid, 0);
2641
+ rb_ary_push(members, rb_str_new2("vid"));
2642
+ }
2643
+ {
2644
+ VALUE rb_cDASGN_CURR = rb_define_class_under(rb_cNode, "DASGN_CURR", rb_cNode);
2645
+ members = rb_ary_new();
2646
+ rb_cNodeSubclass[NODE_DASGN_CURR] = rb_cDASGN_CURR;
2647
+ rb_iv_set(rb_cDASGN_CURR, "__member__", members);
2648
+ rb_define_singleton_method(rb_cDASGN_CURR, "members", node_s_members, 0);
2649
+ rb_define_method(rb_cDASGN_CURR, "value", node_value, 0);
2650
+ rb_ary_push(members, rb_str_new2("value"));
2651
+ rb_define_method(rb_cDASGN_CURR, "vid", node_vid, 0);
2652
+ rb_ary_push(members, rb_str_new2("vid"));
2653
+ }
2654
+ {
2655
+ VALUE rb_cGASGN = rb_define_class_under(rb_cNode, "GASGN", rb_cNode);
2656
+ members = rb_ary_new();
2657
+ rb_cNodeSubclass[NODE_GASGN] = rb_cGASGN;
2658
+ rb_iv_set(rb_cGASGN, "__member__", members);
2659
+ rb_define_singleton_method(rb_cGASGN, "members", node_s_members, 0);
2660
+ rb_define_method(rb_cGASGN, "vid", node_vid, 0);
2661
+ rb_ary_push(members, rb_str_new2("vid"));
2662
+ rb_define_method(rb_cGASGN, "value", node_value, 0);
2663
+ rb_ary_push(members, rb_str_new2("value"));
2664
+ rb_define_method(rb_cGASGN, "entry", node_entry, 0);
2665
+ rb_ary_push(members, rb_str_new2("entry"));
2666
+ }
2667
+ {
2668
+ VALUE rb_cIASGN = rb_define_class_under(rb_cNode, "IASGN", rb_cNode);
2669
+ members = rb_ary_new();
2670
+ rb_cNodeSubclass[NODE_IASGN] = rb_cIASGN;
2671
+ rb_iv_set(rb_cIASGN, "__member__", members);
2672
+ rb_define_singleton_method(rb_cIASGN, "members", node_s_members, 0);
2673
+ rb_define_method(rb_cIASGN, "vid", node_vid, 0);
2674
+ rb_ary_push(members, rb_str_new2("vid"));
2675
+ rb_define_method(rb_cIASGN, "value", node_value, 0);
2676
+ rb_ary_push(members, rb_str_new2("value"));
2677
+ }
2678
+ {
2679
+ VALUE rb_cCDECL = rb_define_class_under(rb_cNode, "CDECL", rb_cNode);
2680
+ members = rb_ary_new();
2681
+ rb_cNodeSubclass[NODE_CDECL] = rb_cCDECL;
2682
+ rb_iv_set(rb_cCDECL, "__member__", members);
2683
+ rb_define_singleton_method(rb_cCDECL, "members", node_s_members, 0);
2684
+ rb_define_method(rb_cCDECL, "vid", node_vid, 0);
2685
+ rb_ary_push(members, rb_str_new2("vid"));
2686
+ rb_define_method(rb_cCDECL, "value", node_value, 0);
2687
+ rb_ary_push(members, rb_str_new2("value"));
2688
+ }
2689
+ {
2690
+ VALUE rb_cCVDECL = rb_define_class_under(rb_cNode, "CVDECL", rb_cNode);
2691
+ members = rb_ary_new();
2692
+ rb_cNodeSubclass[NODE_CVDECL] = rb_cCVDECL;
2693
+ rb_iv_set(rb_cCVDECL, "__member__", members);
2694
+ rb_define_singleton_method(rb_cCVDECL, "members", node_s_members, 0);
2695
+ rb_define_method(rb_cCVDECL, "value", node_value, 0);
2696
+ rb_ary_push(members, rb_str_new2("value"));
2697
+ rb_define_method(rb_cCVDECL, "vid", node_vid, 0);
2698
+ rb_ary_push(members, rb_str_new2("vid"));
2699
+ }
2700
+ {
2701
+ VALUE rb_cCVASGN = rb_define_class_under(rb_cNode, "CVASGN", rb_cNode);
2702
+ members = rb_ary_new();
2703
+ rb_cNodeSubclass[NODE_CVASGN] = rb_cCVASGN;
2704
+ rb_iv_set(rb_cCVASGN, "__member__", members);
2705
+ rb_define_singleton_method(rb_cCVASGN, "members", node_s_members, 0);
2706
+ rb_define_method(rb_cCVASGN, "value", node_value, 0);
2707
+ rb_ary_push(members, rb_str_new2("value"));
2708
+ rb_define_method(rb_cCVASGN, "vid", node_vid, 0);
2709
+ rb_ary_push(members, rb_str_new2("vid"));
2710
+ }
2711
+ {
2712
+ VALUE rb_cLVAR = rb_define_class_under(rb_cNode, "LVAR", rb_cNode);
2713
+ members = rb_ary_new();
2714
+ rb_cNodeSubclass[NODE_LVAR] = rb_cLVAR;
2715
+ rb_iv_set(rb_cLVAR, "__member__", members);
2716
+ rb_define_singleton_method(rb_cLVAR, "members", node_s_members, 0);
2717
+ rb_define_method(rb_cLVAR, "cnt", node_cnt, 0);
2718
+ rb_ary_push(members, rb_str_new2("cnt"));
2719
+ rb_define_method(rb_cLVAR, "vid", node_vid, 0);
2720
+ rb_ary_push(members, rb_str_new2("vid"));
2721
+ }
2722
+ {
2723
+ VALUE rb_cDVAR = rb_define_class_under(rb_cNode, "DVAR", rb_cNode);
2724
+ members = rb_ary_new();
2725
+ rb_cNodeSubclass[NODE_DVAR] = rb_cDVAR;
2726
+ rb_iv_set(rb_cDVAR, "__member__", members);
2727
+ rb_define_singleton_method(rb_cDVAR, "members", node_s_members, 0);
2728
+ rb_define_method(rb_cDVAR, "vid", node_vid, 0);
2729
+ rb_ary_push(members, rb_str_new2("vid"));
2730
+ }
2731
+ {
2732
+ VALUE rb_cGVAR = rb_define_class_under(rb_cNode, "GVAR", rb_cNode);
2733
+ members = rb_ary_new();
2734
+ rb_cNodeSubclass[NODE_GVAR] = rb_cGVAR;
2735
+ rb_iv_set(rb_cGVAR, "__member__", members);
2736
+ rb_define_singleton_method(rb_cGVAR, "members", node_s_members, 0);
2737
+ rb_define_method(rb_cGVAR, "vid", node_vid, 0);
2738
+ rb_ary_push(members, rb_str_new2("vid"));
2739
+ rb_define_method(rb_cGVAR, "entry", node_entry, 0);
2740
+ rb_ary_push(members, rb_str_new2("entry"));
2741
+ }
2742
+ {
2743
+ VALUE rb_cIVAR = rb_define_class_under(rb_cNode, "IVAR", rb_cNode);
2744
+ members = rb_ary_new();
2745
+ rb_cNodeSubclass[NODE_IVAR] = rb_cIVAR;
2746
+ rb_iv_set(rb_cIVAR, "__member__", members);
2747
+ rb_define_singleton_method(rb_cIVAR, "members", node_s_members, 0);
2748
+ rb_define_method(rb_cIVAR, "vid", node_vid, 0);
2749
+ rb_ary_push(members, rb_str_new2("vid"));
2750
+ }
2751
+ {
2752
+ VALUE rb_cCONST = rb_define_class_under(rb_cNode, "CONST", rb_cNode);
2753
+ members = rb_ary_new();
2754
+ rb_cNodeSubclass[NODE_CONST] = rb_cCONST;
2755
+ rb_iv_set(rb_cCONST, "__member__", members);
2756
+ rb_define_singleton_method(rb_cCONST, "members", node_s_members, 0);
2757
+ rb_define_method(rb_cCONST, "vid", node_vid, 0);
2758
+ rb_ary_push(members, rb_str_new2("vid"));
2759
+ }
2760
+ {
2761
+ VALUE rb_cCVAR = rb_define_class_under(rb_cNode, "CVAR", rb_cNode);
2762
+ members = rb_ary_new();
2763
+ rb_cNodeSubclass[NODE_CVAR] = rb_cCVAR;
2764
+ rb_iv_set(rb_cCVAR, "__member__", members);
2765
+ rb_define_singleton_method(rb_cCVAR, "members", node_s_members, 0);
2766
+ rb_define_method(rb_cCVAR, "vid", node_vid, 0);
2767
+ rb_ary_push(members, rb_str_new2("vid"));
2768
+ }
2769
+ {
2770
+ VALUE rb_cBLOCK_ARG = rb_define_class_under(rb_cNode, "BLOCK_ARG", rb_cNode);
2771
+ members = rb_ary_new();
2772
+ rb_cNodeSubclass[NODE_BLOCK_ARG] = rb_cBLOCK_ARG;
2773
+ rb_iv_set(rb_cBLOCK_ARG, "__member__", members);
2774
+ rb_define_singleton_method(rb_cBLOCK_ARG, "members", node_s_members, 0);
2775
+ rb_define_method(rb_cBLOCK_ARG, "cnt", node_cnt, 0);
2776
+ rb_ary_push(members, rb_str_new2("cnt"));
2777
+ }
2778
+ {
2779
+ VALUE rb_cCOLON2 = rb_define_class_under(rb_cNode, "COLON2", rb_cNode);
2780
+ members = rb_ary_new();
2781
+ rb_cNodeSubclass[NODE_COLON2] = rb_cCOLON2;
2782
+ rb_iv_set(rb_cCOLON2, "__member__", members);
2783
+ rb_define_singleton_method(rb_cCOLON2, "members", node_s_members, 0);
2784
+ rb_define_method(rb_cCOLON2, "head", node_head, 0);
2785
+ rb_ary_push(members, rb_str_new2("head"));
2786
+ rb_define_method(rb_cCOLON2, "mid", node_mid, 0);
2787
+ rb_ary_push(members, rb_str_new2("mid"));
2788
+ }
2789
+ {
2790
+ VALUE rb_cCOLON3 = rb_define_class_under(rb_cNode, "COLON3", rb_cNode);
2791
+ members = rb_ary_new();
2792
+ rb_cNodeSubclass[NODE_COLON3] = rb_cCOLON3;
2793
+ rb_iv_set(rb_cCOLON3, "__member__", members);
2794
+ rb_define_singleton_method(rb_cCOLON3, "members", node_s_members, 0);
2795
+ rb_define_method(rb_cCOLON3, "mid", node_mid, 0);
2796
+ rb_ary_push(members, rb_str_new2("mid"));
2797
+ }
2798
+ {
2799
+ VALUE rb_cNTH_REF = rb_define_class_under(rb_cNode, "NTH_REF", rb_cNode);
2800
+ members = rb_ary_new();
2801
+ rb_cNodeSubclass[NODE_NTH_REF] = rb_cNTH_REF;
2802
+ rb_iv_set(rb_cNTH_REF, "__member__", members);
2803
+ rb_define_singleton_method(rb_cNTH_REF, "members", node_s_members, 0);
2804
+ rb_define_method(rb_cNTH_REF, "nth", node_nth, 0);
2805
+ rb_ary_push(members, rb_str_new2("nth"));
2806
+ rb_define_method(rb_cNTH_REF, "cnt", node_cnt, 0);
2807
+ rb_ary_push(members, rb_str_new2("cnt"));
2808
+ }
2809
+ {
2810
+ VALUE rb_cBACK_REF = rb_define_class_under(rb_cNode, "BACK_REF", rb_cNode);
2811
+ members = rb_ary_new();
2812
+ rb_cNodeSubclass[NODE_BACK_REF] = rb_cBACK_REF;
2813
+ rb_iv_set(rb_cBACK_REF, "__member__", members);
2814
+ rb_define_singleton_method(rb_cBACK_REF, "members", node_s_members, 0);
2815
+ rb_define_method(rb_cBACK_REF, "nth", node_nth, 0);
2816
+ rb_ary_push(members, rb_str_new2("nth"));
2817
+ rb_define_method(rb_cBACK_REF, "cnt", node_cnt, 0);
2818
+ rb_ary_push(members, rb_str_new2("cnt"));
2819
+ }
2820
+ {
2821
+ VALUE rb_cHASH = rb_define_class_under(rb_cNode, "HASH", rb_cNode);
2822
+ members = rb_ary_new();
2823
+ rb_cNodeSubclass[NODE_HASH] = rb_cHASH;
2824
+ rb_iv_set(rb_cHASH, "__member__", members);
2825
+ rb_define_singleton_method(rb_cHASH, "members", node_s_members, 0);
2826
+ rb_define_method(rb_cHASH, "head", node_head, 0);
2827
+ rb_ary_push(members, rb_str_new2("head"));
2828
+ }
2829
+ {
2830
+ VALUE rb_cZARRAY = rb_define_class_under(rb_cNode, "ZARRAY", rb_cNode);
2831
+ members = rb_ary_new();
2832
+ rb_cNodeSubclass[NODE_ZARRAY] = rb_cZARRAY;
2833
+ rb_iv_set(rb_cZARRAY, "__member__", members);
2834
+ rb_define_singleton_method(rb_cZARRAY, "members", node_s_members, 0);
2835
+ }
2836
+ {
2837
+ VALUE rb_cARRAY = rb_define_class_under(rb_cNode, "ARRAY", rb_cNode);
2838
+ members = rb_ary_new();
2839
+ rb_cNodeSubclass[NODE_ARRAY] = rb_cARRAY;
2840
+ rb_iv_set(rb_cARRAY, "__member__", members);
2841
+ rb_define_singleton_method(rb_cARRAY, "members", node_s_members, 0);
2842
+ rb_define_method(rb_cARRAY, "alen", node_alen, 0);
2843
+ rb_ary_push(members, rb_str_new2("alen"));
2844
+ rb_define_method(rb_cARRAY, "head", node_head, 0);
2845
+ rb_ary_push(members, rb_str_new2("head"));
2846
+ rb_define_method(rb_cARRAY, "next", node_next, 0);
2847
+ rb_ary_push(members, rb_str_new2("next"));
2848
+ }
2849
+ {
2850
+ VALUE rb_cSTR = rb_define_class_under(rb_cNode, "STR", rb_cNode);
2851
+ members = rb_ary_new();
2852
+ rb_cNodeSubclass[NODE_STR] = rb_cSTR;
2853
+ rb_iv_set(rb_cSTR, "__member__", members);
2854
+ rb_define_singleton_method(rb_cSTR, "members", node_s_members, 0);
2855
+ rb_define_method(rb_cSTR, "lit", node_lit, 0);
2856
+ rb_ary_push(members, rb_str_new2("lit"));
2857
+ }
2858
+ {
2859
+ VALUE rb_cDREGX = rb_define_class_under(rb_cNode, "DREGX", rb_cNode);
2860
+ members = rb_ary_new();
2861
+ rb_cNodeSubclass[NODE_DREGX] = rb_cDREGX;
2862
+ rb_iv_set(rb_cDREGX, "__member__", members);
2863
+ rb_define_singleton_method(rb_cDREGX, "members", node_s_members, 0);
2864
+ rb_define_method(rb_cDREGX, "lit", node_lit, 0);
2865
+ rb_ary_push(members, rb_str_new2("lit"));
2866
+ rb_define_method(rb_cDREGX, "next", node_next, 0);
2867
+ rb_ary_push(members, rb_str_new2("next"));
2868
+ rb_define_method(rb_cDREGX, "cflag", node_cflag, 0);
2869
+ rb_ary_push(members, rb_str_new2("cflag"));
2870
+ }
2871
+ {
2872
+ VALUE rb_cDREGX_ONCE = rb_define_class_under(rb_cNode, "DREGX_ONCE", rb_cNode);
2873
+ members = rb_ary_new();
2874
+ rb_cNodeSubclass[NODE_DREGX_ONCE] = rb_cDREGX_ONCE;
2875
+ rb_iv_set(rb_cDREGX_ONCE, "__member__", members);
2876
+ rb_define_singleton_method(rb_cDREGX_ONCE, "members", node_s_members, 0);
2877
+ rb_define_method(rb_cDREGX_ONCE, "lit", node_lit, 0);
2878
+ rb_ary_push(members, rb_str_new2("lit"));
2879
+ rb_define_method(rb_cDREGX_ONCE, "next", node_next, 0);
2880
+ rb_ary_push(members, rb_str_new2("next"));
2881
+ rb_define_method(rb_cDREGX_ONCE, "cflag", node_cflag, 0);
2882
+ rb_ary_push(members, rb_str_new2("cflag"));
2883
+ }
2884
+ {
2885
+ VALUE rb_cDSTR = rb_define_class_under(rb_cNode, "DSTR", rb_cNode);
2886
+ members = rb_ary_new();
2887
+ rb_cNodeSubclass[NODE_DSTR] = rb_cDSTR;
2888
+ rb_iv_set(rb_cDSTR, "__member__", members);
2889
+ rb_define_singleton_method(rb_cDSTR, "members", node_s_members, 0);
2890
+ rb_define_method(rb_cDSTR, "lit", node_lit, 0);
2891
+ rb_ary_push(members, rb_str_new2("lit"));
2892
+ rb_define_method(rb_cDSTR, "next", node_next, 0);
2893
+ rb_ary_push(members, rb_str_new2("next"));
2894
+ }
2895
+ {
2896
+ VALUE rb_cDXSTR = rb_define_class_under(rb_cNode, "DXSTR", rb_cNode);
2897
+ members = rb_ary_new();
2898
+ rb_cNodeSubclass[NODE_DXSTR] = rb_cDXSTR;
2899
+ rb_iv_set(rb_cDXSTR, "__member__", members);
2900
+ rb_define_singleton_method(rb_cDXSTR, "members", node_s_members, 0);
2901
+ rb_define_method(rb_cDXSTR, "lit", node_lit, 0);
2902
+ rb_ary_push(members, rb_str_new2("lit"));
2903
+ rb_define_method(rb_cDXSTR, "next", node_next, 0);
2904
+ rb_ary_push(members, rb_str_new2("next"));
2905
+ }
2906
+ {
2907
+ VALUE rb_cXSTR = rb_define_class_under(rb_cNode, "XSTR", rb_cNode);
2908
+ members = rb_ary_new();
2909
+ rb_cNodeSubclass[NODE_XSTR] = rb_cXSTR;
2910
+ rb_iv_set(rb_cXSTR, "__member__", members);
2911
+ rb_define_singleton_method(rb_cXSTR, "members", node_s_members, 0);
2912
+ rb_define_method(rb_cXSTR, "lit", node_lit, 0);
2913
+ rb_ary_push(members, rb_str_new2("lit"));
2914
+ }
2915
+ #if defined(C_ALLOCA) || RUBY_VERSION_CODE >= 190
2916
+ {
2917
+ VALUE rb_cALLOCA = rb_define_class_under(rb_cNode, "ALLOCA", rb_cNode);
2918
+ members = rb_ary_new();
2919
+ rb_cNodeSubclass[NODE_ALLOCA] = rb_cALLOCA;
2920
+ rb_iv_set(rb_cALLOCA, "__member__", members);
2921
+ rb_define_singleton_method(rb_cALLOCA, "members", node_s_members, 0);
2922
+ rb_define_method(rb_cALLOCA, "lit", node_lit, 0);
2923
+ rb_ary_push(members, rb_str_new2("lit"));
2924
+ rb_define_method(rb_cALLOCA, "value", node_value, 0);
2925
+ rb_ary_push(members, rb_str_new2("value"));
2926
+ rb_define_method(rb_cALLOCA, "cnt", node_cnt, 0);
2927
+ rb_ary_push(members, rb_str_new2("cnt"));
2928
+ }
2929
+ #endif
2930
+ {
2931
+ VALUE rb_cLIT = rb_define_class_under(rb_cNode, "LIT", rb_cNode);
2932
+ members = rb_ary_new();
2933
+ rb_cNodeSubclass[NODE_LIT] = rb_cLIT;
2934
+ rb_iv_set(rb_cLIT, "__member__", members);
2935
+ rb_define_singleton_method(rb_cLIT, "members", node_s_members, 0);
2936
+ rb_define_method(rb_cLIT, "lit", node_lit, 0);
2937
+ rb_ary_push(members, rb_str_new2("lit"));
2938
+ }
2939
+ {
2940
+ VALUE rb_cATTRSET = rb_define_class_under(rb_cNode, "ATTRSET", rb_cNode);
2941
+ members = rb_ary_new();
2942
+ rb_cNodeSubclass[NODE_ATTRSET] = rb_cATTRSET;
2943
+ rb_iv_set(rb_cATTRSET, "__member__", members);
2944
+ rb_define_singleton_method(rb_cATTRSET, "members", node_s_members, 0);
2945
+ rb_define_method(rb_cATTRSET, "vid", node_vid, 0);
2946
+ rb_ary_push(members, rb_str_new2("vid"));
2947
+ }
2948
+ {
2949
+ VALUE rb_cDEFN = rb_define_class_under(rb_cNode, "DEFN", rb_cNode);
2950
+ members = rb_ary_new();
2951
+ rb_cNodeSubclass[NODE_DEFN] = rb_cDEFN;
2952
+ rb_iv_set(rb_cDEFN, "__member__", members);
2953
+ rb_define_singleton_method(rb_cDEFN, "members", node_s_members, 0);
2954
+ rb_define_method(rb_cDEFN, "defn", node_defn, 0);
2955
+ rb_ary_push(members, rb_str_new2("defn"));
2956
+ rb_define_method(rb_cDEFN, "mid", node_mid, 0);
2957
+ rb_ary_push(members, rb_str_new2("mid"));
2958
+ rb_define_method(rb_cDEFN, "noex", node_noex, 0);
2959
+ rb_ary_push(members, rb_str_new2("noex"));
2960
+ }
2961
+ {
2962
+ VALUE rb_cDEFS = rb_define_class_under(rb_cNode, "DEFS", rb_cNode);
2963
+ members = rb_ary_new();
2964
+ rb_cNodeSubclass[NODE_DEFS] = rb_cDEFS;
2965
+ rb_iv_set(rb_cDEFS, "__member__", members);
2966
+ rb_define_singleton_method(rb_cDEFS, "members", node_s_members, 0);
2967
+ rb_define_method(rb_cDEFS, "defn", node_defn, 0);
2968
+ rb_ary_push(members, rb_str_new2("defn"));
2969
+ rb_define_method(rb_cDEFS, "recv", node_recv, 0);
2970
+ rb_ary_push(members, rb_str_new2("recv"));
2971
+ rb_define_method(rb_cDEFS, "mid", node_mid, 0);
2972
+ rb_ary_push(members, rb_str_new2("mid"));
2973
+ }
2974
+ {
2975
+ VALUE rb_cUNDEF = rb_define_class_under(rb_cNode, "UNDEF", rb_cNode);
2976
+ members = rb_ary_new();
2977
+ rb_cNodeSubclass[NODE_UNDEF] = rb_cUNDEF;
2978
+ rb_iv_set(rb_cUNDEF, "__member__", members);
2979
+ rb_define_singleton_method(rb_cUNDEF, "members", node_s_members, 0);
2980
+ rb_define_method(rb_cUNDEF, "mid", node_mid, 0);
2981
+ rb_ary_push(members, rb_str_new2("mid"));
2982
+ }
2983
+ {
2984
+ VALUE rb_cALIAS = rb_define_class_under(rb_cNode, "ALIAS", rb_cNode);
2985
+ members = rb_ary_new();
2986
+ rb_cNodeSubclass[NODE_ALIAS] = rb_cALIAS;
2987
+ rb_iv_set(rb_cALIAS, "__member__", members);
2988
+ rb_define_singleton_method(rb_cALIAS, "members", node_s_members, 0);
2989
+ rb_define_method(rb_cALIAS, "first", node_1st, 0);
2990
+ rb_ary_push(members, rb_str_new2("first"));
2991
+ rb_define_method(rb_cALIAS, "second", node_2nd, 0);
2992
+ rb_ary_push(members, rb_str_new2("second"));
2993
+ }
2994
+ {
2995
+ VALUE rb_cVALIAS = rb_define_class_under(rb_cNode, "VALIAS", rb_cNode);
2996
+ members = rb_ary_new();
2997
+ rb_cNodeSubclass[NODE_VALIAS] = rb_cVALIAS;
2998
+ rb_iv_set(rb_cVALIAS, "__member__", members);
2999
+ rb_define_singleton_method(rb_cVALIAS, "members", node_s_members, 0);
3000
+ rb_define_method(rb_cVALIAS, "first", node_1st, 0);
3001
+ rb_ary_push(members, rb_str_new2("first"));
3002
+ rb_define_method(rb_cVALIAS, "second", node_2nd, 0);
3003
+ rb_ary_push(members, rb_str_new2("second"));
3004
+ }
3005
+ {
3006
+ VALUE rb_cSCLASS = rb_define_class_under(rb_cNode, "SCLASS", rb_cNode);
3007
+ members = rb_ary_new();
3008
+ rb_cNodeSubclass[NODE_SCLASS] = rb_cSCLASS;
3009
+ rb_iv_set(rb_cSCLASS, "__member__", members);
3010
+ rb_define_singleton_method(rb_cSCLASS, "members", node_s_members, 0);
3011
+ rb_define_method(rb_cSCLASS, "recv", node_recv, 0);
3012
+ rb_ary_push(members, rb_str_new2("recv"));
3013
+ rb_define_method(rb_cSCLASS, "body", node_body, 0);
3014
+ rb_ary_push(members, rb_str_new2("body"));
3015
+ }
3016
+ {
3017
+ VALUE rb_cDEFINED = rb_define_class_under(rb_cNode, "DEFINED", rb_cNode);
3018
+ members = rb_ary_new();
3019
+ rb_cNodeSubclass[NODE_DEFINED] = rb_cDEFINED;
3020
+ rb_iv_set(rb_cDEFINED, "__member__", members);
3021
+ rb_define_singleton_method(rb_cDEFINED, "members", node_s_members, 0);
3022
+ rb_define_method(rb_cDEFINED, "head", node_head, 0);
3023
+ rb_ary_push(members, rb_str_new2("head"));
3024
+ }
3025
+ {
3026
+ VALUE rb_cIFUNC = rb_define_class_under(rb_cNode, "IFUNC", rb_cNode);
3027
+ members = rb_ary_new();
3028
+ rb_cNodeSubclass[NODE_IFUNC] = rb_cIFUNC;
3029
+ rb_iv_set(rb_cIFUNC, "__member__", members);
3030
+ rb_define_singleton_method(rb_cIFUNC, "members", node_s_members, 0);
3031
+ rb_define_method(rb_cIFUNC, "cfnc", node_cfnc, 0);
3032
+ rb_ary_push(members, rb_str_new2("cfnc"));
3033
+ rb_define_method(rb_cIFUNC, "tval", node_tval, 0);
3034
+ rb_ary_push(members, rb_str_new2("tval"));
3035
+ rb_define_method(rb_cIFUNC, "argc", node_argc, 0);
3036
+ rb_ary_push(members, rb_str_new2("argc"));
3037
+ }
3038
+ {
3039
+ VALUE rb_cCFUNC = rb_define_class_under(rb_cNode, "CFUNC", rb_cNode);
3040
+ members = rb_ary_new();
3041
+ rb_cNodeSubclass[NODE_CFUNC] = rb_cCFUNC;
3042
+ rb_iv_set(rb_cCFUNC, "__member__", members);
3043
+ rb_define_singleton_method(rb_cCFUNC, "members", node_s_members, 0);
3044
+ rb_define_method(rb_cCFUNC, "cfnc", node_cfnc, 0);
3045
+ rb_ary_push(members, rb_str_new2("cfnc"));
3046
+ rb_define_method(rb_cCFUNC, "tval", node_tval, 0);
3047
+ rb_ary_push(members, rb_str_new2("tval"));
3048
+ rb_define_method(rb_cCFUNC, "argc", node_argc, 0);
3049
+ rb_ary_push(members, rb_str_new2("argc"));
3050
+ }
3051
+ {
3052
+ VALUE rb_cCREF = rb_define_class_under(rb_cNode, "CREF", rb_cNode);
3053
+ members = rb_ary_new();
3054
+ rb_cNodeSubclass[NODE_CREF] = rb_cCREF;
3055
+ rb_iv_set(rb_cCREF, "__member__", members);
3056
+ rb_define_singleton_method(rb_cCREF, "members", node_s_members, 0);
3057
+ rb_define_method(rb_cCREF, "clss", node_clss, 0);
3058
+ rb_ary_push(members, rb_str_new2("clss"));
3059
+ rb_define_method(rb_cCREF, "next", node_next, 0);
3060
+ rb_ary_push(members, rb_str_new2("next"));
3061
+ rb_define_method(rb_cCREF, "body", node_body, 0);
3062
+ rb_ary_push(members, rb_str_new2("body"));
3063
+ }
3064
+ {
3065
+ VALUE rb_cBMETHOD = rb_define_class_under(rb_cNode, "BMETHOD", rb_cNode);
3066
+ members = rb_ary_new();
3067
+ rb_cNodeSubclass[NODE_BMETHOD] = rb_cBMETHOD;
3068
+ rb_iv_set(rb_cBMETHOD, "__member__", members);
3069
+ rb_define_singleton_method(rb_cBMETHOD, "members", node_s_members, 0);
3070
+ rb_define_method(rb_cBMETHOD, "cval", node_cval, 0);
3071
+ rb_ary_push(members, rb_str_new2("cval"));
3072
+ }
3073
+ {
3074
+ VALUE rb_cMEMO = rb_define_class_under(rb_cNode, "MEMO", rb_cNode);
3075
+ members = rb_ary_new();
3076
+ rb_cNodeSubclass[NODE_MEMO] = rb_cMEMO;
3077
+ rb_iv_set(rb_cMEMO, "__member__", members);
3078
+ rb_define_singleton_method(rb_cMEMO, "members", node_s_members, 0);
3079
+ rb_define_method(rb_cMEMO, "lit", node_lit, 0);
3080
+ rb_ary_push(members, rb_str_new2("lit"));
3081
+ rb_define_method(rb_cMEMO, "tval", node_tval, 0);
3082
+ rb_ary_push(members, rb_str_new2("tval"));
3083
+ }
3084
+ {
3085
+ VALUE rb_cEVSTR = rb_define_class_under(rb_cNode, "EVSTR", rb_cNode);
3086
+ members = rb_ary_new();
3087
+ rb_cNodeSubclass[NODE_EVSTR] = rb_cEVSTR;
3088
+ rb_iv_set(rb_cEVSTR, "__member__", members);
3089
+ rb_define_singleton_method(rb_cEVSTR, "members", node_s_members, 0);
3090
+ rb_define_method(rb_cEVSTR, "body", node_body, 0);
3091
+ rb_ary_push(members, rb_str_new2("body"));
3092
+ }
3093
+ {
3094
+ VALUE rb_cDMETHOD = rb_define_class_under(rb_cNode, "DMETHOD", rb_cNode);
3095
+ members = rb_ary_new();
3096
+ rb_cNodeSubclass[NODE_DMETHOD] = rb_cDMETHOD;
3097
+ rb_iv_set(rb_cDMETHOD, "__member__", members);
3098
+ rb_define_singleton_method(rb_cDMETHOD, "members", node_s_members, 0);
3099
+ rb_define_method(rb_cDMETHOD, "cval", node_cval, 0);
3100
+ rb_ary_push(members, rb_str_new2("cval"));
3101
+ }
3102
+ {
3103
+ VALUE rb_cNEWLINE = rb_define_class_under(rb_cNode, "NEWLINE", rb_cNode);
3104
+ members = rb_ary_new();
3105
+ rb_cNodeSubclass[NODE_NEWLINE] = rb_cNEWLINE;
3106
+ rb_iv_set(rb_cNEWLINE, "__member__", members);
3107
+ rb_define_singleton_method(rb_cNEWLINE, "members", node_s_members, 0);
3108
+ rb_define_method(rb_cNEWLINE, "nth", node_nth, 0);
3109
+ rb_ary_push(members, rb_str_new2("nth"));
3110
+ rb_define_method(rb_cNEWLINE, "next", node_next, 0);
3111
+ rb_ary_push(members, rb_str_new2("next"));
3112
+ }
3113
+ {
3114
+ VALUE rb_cMETHOD = rb_define_class_under(rb_cNode, "METHOD", rb_cNode);
3115
+ members = rb_ary_new();
3116
+ rb_cNodeSubclass[NODE_METHOD] = rb_cMETHOD;
3117
+ rb_iv_set(rb_cMETHOD, "__member__", members);
3118
+ rb_define_singleton_method(rb_cMETHOD, "members", node_s_members, 0);
3119
+ rb_define_method(rb_cMETHOD, "noex", node_noex, 0);
3120
+ rb_ary_push(members, rb_str_new2("noex"));
3121
+ rb_define_method(rb_cMETHOD, "body", node_body, 0);
3122
+ rb_ary_push(members, rb_str_new2("body"));
3123
+ }
3124
+ {
3125
+ VALUE rb_cFBODY = rb_define_class_under(rb_cNode, "FBODY", rb_cNode);
3126
+ members = rb_ary_new();
3127
+ rb_cNodeSubclass[NODE_FBODY] = rb_cFBODY;
3128
+ rb_iv_set(rb_cFBODY, "__member__", members);
3129
+ rb_define_singleton_method(rb_cFBODY, "members", node_s_members, 0);
3130
+ rb_define_method(rb_cFBODY, "orig", node_orig, 0);
3131
+ rb_ary_push(members, rb_str_new2("orig"));
3132
+ rb_define_method(rb_cFBODY, "mid", node_mid, 0);
3133
+ rb_ary_push(members, rb_str_new2("mid"));
3134
+ rb_define_method(rb_cFBODY, "head", node_head, 0);
3135
+ rb_ary_push(members, rb_str_new2("head"));
3136
+ }
3137
+ {
3138
+ VALUE rb_cCLASS = rb_define_class_under(rb_cNode, "CLASS", rb_cNode);
3139
+ members = rb_ary_new();
3140
+ rb_cNodeSubclass[NODE_CLASS] = rb_cCLASS;
3141
+ rb_iv_set(rb_cCLASS, "__member__", members);
3142
+ rb_define_singleton_method(rb_cCLASS, "members", node_s_members, 0);
3143
+ rb_define_method(rb_cCLASS, "super", node_super, 0);
3144
+ rb_ary_push(members, rb_str_new2("super"));
3145
+ rb_define_method(rb_cCLASS, "cpath", node_cpath, 0);
3146
+ rb_ary_push(members, rb_str_new2("cpath"));
3147
+ rb_define_method(rb_cCLASS, "body", node_body, 0);
3148
+ rb_ary_push(members, rb_str_new2("body"));
3149
+ }
3150
+ {
3151
+ VALUE rb_cMODULE = rb_define_class_under(rb_cNode, "MODULE", rb_cNode);
3152
+ members = rb_ary_new();
3153
+ rb_cNodeSubclass[NODE_MODULE] = rb_cMODULE;
3154
+ rb_iv_set(rb_cMODULE, "__member__", members);
3155
+ rb_define_singleton_method(rb_cMODULE, "members", node_s_members, 0);
3156
+ rb_define_method(rb_cMODULE, "cpath", node_cpath, 0);
3157
+ rb_ary_push(members, rb_str_new2("cpath"));
3158
+ rb_define_method(rb_cMODULE, "body", node_body, 0);
3159
+ rb_ary_push(members, rb_str_new2("body"));
3160
+ }
3161
+ {
3162
+ VALUE rb_cDSYM = rb_define_class_under(rb_cNode, "DSYM", rb_cNode);
3163
+ members = rb_ary_new();
3164
+ rb_cNodeSubclass[NODE_DSYM] = rb_cDSYM;
3165
+ rb_iv_set(rb_cDSYM, "__member__", members);
3166
+ rb_define_singleton_method(rb_cDSYM, "members", node_s_members, 0);
3167
+ rb_define_method(rb_cDSYM, "lit", node_lit, 0);
3168
+ rb_ary_push(members, rb_str_new2("lit"));
3169
+ rb_define_method(rb_cDSYM, "next", node_next, 0);
3170
+ rb_ary_push(members, rb_str_new2("next"));
3171
+ }
3172
+ {
3173
+ VALUE rb_cATTRASGN = rb_define_class_under(rb_cNode, "ATTRASGN", rb_cNode);
3174
+ members = rb_ary_new();
3175
+ rb_cNodeSubclass[NODE_ATTRASGN] = rb_cATTRASGN;
3176
+ rb_iv_set(rb_cATTRASGN, "__member__", members);
3177
+ rb_define_singleton_method(rb_cATTRASGN, "members", node_s_members, 0);
3178
+ rb_define_method(rb_cATTRASGN, "mid", node_mid, 0);
3179
+ rb_ary_push(members, rb_str_new2("mid"));
3180
+ rb_define_method(rb_cATTRASGN, "recv", node_recv, 0);
3181
+ rb_ary_push(members, rb_str_new2("recv"));
3182
+ rb_define_method(rb_cATTRASGN, "args", node_args, 0);
3183
+ rb_ary_push(members, rb_str_new2("args"));
3184
+ }
3185
+ }
3186
+
3187
+