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