rubinius-melbourne 1.0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,254 @@
1
+ /* This file is generated by node_types.rb. Do not edit. */
2
+
3
+ #include "namespace.h"
4
+ #include "node_types.hpp"
5
+
6
+ #include <stdio.h>
7
+
8
+ namespace MELBOURNE {
9
+ static const char node_types[] = {
10
+ "method\0"
11
+ "fbody\0"
12
+ "cfunc\0"
13
+ "scope\0"
14
+ "block\0"
15
+ "if\0"
16
+ "case\0"
17
+ "when\0"
18
+ "opt_n\0"
19
+ "while\0"
20
+ "until\0"
21
+ "iter\0"
22
+ "for\0"
23
+ "break\0"
24
+ "next\0"
25
+ "redo\0"
26
+ "retry\0"
27
+ "begin\0"
28
+ "rescue\0"
29
+ "resbody\0"
30
+ "ensure\0"
31
+ "and\0"
32
+ "or\0"
33
+ "not\0"
34
+ "masgn\0"
35
+ "lasgn\0"
36
+ "dasgn\0"
37
+ "dasgn_curr\0"
38
+ "gasgn\0"
39
+ "iasgn\0"
40
+ "cdecl\0"
41
+ "cvasgn\0"
42
+ "cvdecl\0"
43
+ "op_asgn1\0"
44
+ "op_asgn2\0"
45
+ "op_asgn_and\0"
46
+ "op_asgn_or\0"
47
+ "call\0"
48
+ "fcall\0"
49
+ "vcall\0"
50
+ "super\0"
51
+ "zsuper\0"
52
+ "array\0"
53
+ "zarray\0"
54
+ "hash\0"
55
+ "return\0"
56
+ "yield\0"
57
+ "lvar\0"
58
+ "dvar\0"
59
+ "gvar\0"
60
+ "ivar\0"
61
+ "const\0"
62
+ "cvar\0"
63
+ "nth_ref\0"
64
+ "back_ref\0"
65
+ "match\0"
66
+ "match2\0"
67
+ "match3\0"
68
+ "lit\0"
69
+ "str\0"
70
+ "dstr\0"
71
+ "xstr\0"
72
+ "dxstr\0"
73
+ "evstr\0"
74
+ "dregx\0"
75
+ "dregx_once\0"
76
+ "args\0"
77
+ "argscat\0"
78
+ "argspush\0"
79
+ "splat\0"
80
+ "to_ary\0"
81
+ "svalue\0"
82
+ "block_arg\0"
83
+ "block_pass\0"
84
+ "defn\0"
85
+ "defs\0"
86
+ "alias\0"
87
+ "valias\0"
88
+ "undef\0"
89
+ "class\0"
90
+ "module\0"
91
+ "sclass\0"
92
+ "colon2\0"
93
+ "colon3\0"
94
+ "cref\0"
95
+ "dot2\0"
96
+ "dot3\0"
97
+ "flip2\0"
98
+ "flip3\0"
99
+ "attrset\0"
100
+ "self\0"
101
+ "nil\0"
102
+ "true\0"
103
+ "false\0"
104
+ "defined\0"
105
+ "newline\0"
106
+ "postexe\0"
107
+ "dmethod\0"
108
+ "bmethod\0"
109
+ "memo\0"
110
+ "ifunc\0"
111
+ "dsym\0"
112
+ "attrasgn\0"
113
+ "regex\0"
114
+ "fixnum\0"
115
+ "number\0"
116
+ "hexnum\0"
117
+ "binnum\0"
118
+ "octnum\0"
119
+ "float\0"
120
+ "negate\0"
121
+ "last\0"
122
+ "file\0"
123
+ "preexe\0"
124
+ };
125
+
126
+ static const unsigned short node_types_offsets[] = {
127
+ 0,
128
+ 7,
129
+ 13,
130
+ 19,
131
+ 25,
132
+ 31,
133
+ 34,
134
+ 39,
135
+ 44,
136
+ 50,
137
+ 56,
138
+ 62,
139
+ 67,
140
+ 71,
141
+ 77,
142
+ 82,
143
+ 87,
144
+ 93,
145
+ 99,
146
+ 106,
147
+ 114,
148
+ 121,
149
+ 125,
150
+ 128,
151
+ 132,
152
+ 138,
153
+ 144,
154
+ 150,
155
+ 161,
156
+ 167,
157
+ 173,
158
+ 179,
159
+ 186,
160
+ 193,
161
+ 202,
162
+ 211,
163
+ 223,
164
+ 234,
165
+ 239,
166
+ 245,
167
+ 251,
168
+ 257,
169
+ 264,
170
+ 270,
171
+ 277,
172
+ 282,
173
+ 289,
174
+ 295,
175
+ 300,
176
+ 305,
177
+ 310,
178
+ 315,
179
+ 321,
180
+ 326,
181
+ 334,
182
+ 343,
183
+ 349,
184
+ 356,
185
+ 363,
186
+ 367,
187
+ 371,
188
+ 376,
189
+ 381,
190
+ 387,
191
+ 393,
192
+ 399,
193
+ 410,
194
+ 415,
195
+ 423,
196
+ 432,
197
+ 438,
198
+ 445,
199
+ 452,
200
+ 462,
201
+ 473,
202
+ 478,
203
+ 483,
204
+ 489,
205
+ 496,
206
+ 502,
207
+ 508,
208
+ 515,
209
+ 522,
210
+ 529,
211
+ 536,
212
+ 541,
213
+ 546,
214
+ 551,
215
+ 557,
216
+ 563,
217
+ 571,
218
+ 576,
219
+ 580,
220
+ 585,
221
+ 591,
222
+ 599,
223
+ 607,
224
+ 615,
225
+ 623,
226
+ 631,
227
+ 636,
228
+ 642,
229
+ 647,
230
+ 656,
231
+ 662,
232
+ 669,
233
+ 676,
234
+ 683,
235
+ 690,
236
+ 697,
237
+ 703,
238
+ 710,
239
+ 715,
240
+ 720,
241
+ 727
242
+ };
243
+
244
+ const char *get_node_type_string(enum node_type node) {
245
+ if(node < 114) {
246
+ return node_types + node_types_offsets[node];
247
+ } else {
248
+ #define NODE_STRING_MESSAGE_LEN 20
249
+ static char msg[NODE_STRING_MESSAGE_LEN];
250
+ snprintf(msg, NODE_STRING_MESSAGE_LEN, "unknown node type: %d", node);
251
+ return msg;
252
+ }
253
+ }
254
+ };
@@ -0,0 +1,127 @@
1
+ #ifndef MEL_NODE_TYPES_HPP
2
+ #define MEL_NODE_TYPES_HPP
3
+ /* This file is generated by node_types.rb. Do not edit. */
4
+
5
+ namespace MELBOURNE {
6
+ enum node_type {
7
+ NODE_METHOD,
8
+ NODE_FBODY,
9
+ NODE_CFUNC,
10
+ NODE_SCOPE,
11
+ NODE_BLOCK,
12
+ NODE_IF,
13
+ NODE_CASE,
14
+ NODE_WHEN,
15
+ NODE_OPT_N,
16
+ NODE_WHILE,
17
+ NODE_UNTIL,
18
+ NODE_ITER,
19
+ NODE_FOR,
20
+ NODE_BREAK,
21
+ NODE_NEXT,
22
+ NODE_REDO,
23
+ NODE_RETRY,
24
+ NODE_BEGIN,
25
+ NODE_RESCUE,
26
+ NODE_RESBODY,
27
+ NODE_ENSURE,
28
+ NODE_AND,
29
+ NODE_OR,
30
+ NODE_NOT,
31
+ NODE_MASGN,
32
+ NODE_LASGN,
33
+ NODE_DASGN,
34
+ NODE_DASGN_CURR,
35
+ NODE_GASGN,
36
+ NODE_IASGN,
37
+ NODE_CDECL,
38
+ NODE_CVASGN,
39
+ NODE_CVDECL,
40
+ NODE_OP_ASGN1,
41
+ NODE_OP_ASGN2,
42
+ NODE_OP_ASGN_AND,
43
+ NODE_OP_ASGN_OR,
44
+ NODE_CALL,
45
+ NODE_FCALL,
46
+ NODE_VCALL,
47
+ NODE_SUPER,
48
+ NODE_ZSUPER,
49
+ NODE_ARRAY,
50
+ NODE_ZARRAY,
51
+ NODE_HASH,
52
+ NODE_RETURN,
53
+ NODE_YIELD,
54
+ NODE_LVAR,
55
+ NODE_DVAR,
56
+ NODE_GVAR,
57
+ NODE_IVAR,
58
+ NODE_CONST,
59
+ NODE_CVAR,
60
+ NODE_NTH_REF,
61
+ NODE_BACK_REF,
62
+ NODE_MATCH,
63
+ NODE_MATCH2,
64
+ NODE_MATCH3,
65
+ NODE_LIT,
66
+ NODE_STR,
67
+ NODE_DSTR,
68
+ NODE_XSTR,
69
+ NODE_DXSTR,
70
+ NODE_EVSTR,
71
+ NODE_DREGX,
72
+ NODE_DREGX_ONCE,
73
+ NODE_ARGS,
74
+ NODE_ARGSCAT,
75
+ NODE_ARGSPUSH,
76
+ NODE_SPLAT,
77
+ NODE_TO_ARY,
78
+ NODE_SVALUE,
79
+ NODE_BLOCK_ARG,
80
+ NODE_BLOCK_PASS,
81
+ NODE_DEFN,
82
+ NODE_DEFS,
83
+ NODE_ALIAS,
84
+ NODE_VALIAS,
85
+ NODE_UNDEF,
86
+ NODE_CLASS,
87
+ NODE_MODULE,
88
+ NODE_SCLASS,
89
+ NODE_COLON2,
90
+ NODE_COLON3,
91
+ NODE_CREF,
92
+ NODE_DOT2,
93
+ NODE_DOT3,
94
+ NODE_FLIP2,
95
+ NODE_FLIP3,
96
+ NODE_ATTRSET,
97
+ NODE_SELF,
98
+ NODE_NIL,
99
+ NODE_TRUE,
100
+ NODE_FALSE,
101
+ NODE_DEFINED,
102
+ NODE_NEWLINE,
103
+ NODE_POSTEXE,
104
+ NODE_DMETHOD,
105
+ NODE_BMETHOD,
106
+ NODE_MEMO,
107
+ NODE_IFUNC,
108
+ NODE_DSYM,
109
+ NODE_ATTRASGN,
110
+ NODE_REGEX,
111
+ NODE_FIXNUM,
112
+ NODE_NUMBER,
113
+ NODE_HEXNUM,
114
+ NODE_BINNUM,
115
+ NODE_OCTNUM,
116
+ NODE_FLOAT,
117
+ NODE_NEGATE,
118
+ NODE_LAST,
119
+ NODE_FILE,
120
+ NODE_PREEXE
121
+ };
122
+
123
+ const char *get_node_type_string(enum node_type nt);
124
+
125
+ };
126
+
127
+ #endif
@@ -0,0 +1,185 @@
1
+ node_types = %w[
2
+ method
3
+ fbody
4
+ cfunc
5
+ scope
6
+ block
7
+ if
8
+ case
9
+ when
10
+ opt_n
11
+ while
12
+ until
13
+ iter
14
+ for
15
+ break
16
+ next
17
+ redo
18
+ retry
19
+ begin
20
+ rescue
21
+ resbody
22
+ ensure
23
+ and
24
+ or
25
+ not
26
+ masgn
27
+ lasgn
28
+ dasgn
29
+ dasgn_curr
30
+ gasgn
31
+ iasgn
32
+ cdecl
33
+ cvasgn
34
+ cvdecl
35
+ op_asgn1
36
+ op_asgn2
37
+ op_asgn_and
38
+ op_asgn_or
39
+ call
40
+ fcall
41
+ vcall
42
+ super
43
+ zsuper
44
+ array
45
+ zarray
46
+ hash
47
+ return
48
+ yield
49
+ lvar
50
+ dvar
51
+ gvar
52
+ ivar
53
+ const
54
+ cvar
55
+ nth_ref
56
+ back_ref
57
+ match
58
+ match2
59
+ match3
60
+ lit
61
+ str
62
+ dstr
63
+ xstr
64
+ dxstr
65
+ evstr
66
+ dregx
67
+ dregx_once
68
+ args
69
+ argscat
70
+ argspush
71
+ splat
72
+ to_ary
73
+ svalue
74
+ block_arg
75
+ block_pass
76
+ defn
77
+ defs
78
+ alias
79
+ valias
80
+ undef
81
+ class
82
+ module
83
+ sclass
84
+ colon2
85
+ colon3
86
+ cref
87
+ dot2
88
+ dot3
89
+ flip2
90
+ flip3
91
+ attrset
92
+ self
93
+ nil
94
+ true
95
+ false
96
+ defined
97
+ newline
98
+ postexe
99
+ dmethod
100
+ bmethod
101
+ memo
102
+ ifunc
103
+ dsym
104
+ attrasgn
105
+ regex
106
+ fixnum
107
+ number
108
+ hexnum
109
+ binnum
110
+ octnum
111
+ float
112
+ negate
113
+ last
114
+ file
115
+ preexe
116
+ ]
117
+
118
+ def write_node_types(list)
119
+ File.open("node_types.cpp", "wb") do |f|
120
+ f.puts <<EOF
121
+ /* This file is generated by node_types.rb. Do not edit. */
122
+
123
+ #include "node_types.hpp"
124
+
125
+ #include <stdio.h>
126
+
127
+ namespace MELBOURNE {
128
+ static const char node_types[] = {
129
+ EOF
130
+
131
+ indexes = [0]
132
+ list.each do |type|
133
+ f.puts(" \"#{type}\\0\"")
134
+ indexes.push indexes.last + type.size + 1
135
+ end
136
+
137
+ f.puts(" };")
138
+ f.puts
139
+
140
+ f.puts(" static const unsigned short node_types_offsets[] = {")
141
+
142
+ f.puts indexes.map { |i| " #{i}" }.join(",\n")
143
+
144
+ f.puts <<EOF
145
+ };
146
+
147
+ const char *get_node_type_string(enum node_type node) {
148
+ if(node < #{list.size}) {
149
+ return node_types + node_types_offsets[node];
150
+ } else {
151
+ #define NODE_STRING_MESSAGE_LEN 20
152
+ static char msg[NODE_STRING_MESSAGE_LEN];
153
+ snprintf(msg, NODE_STRING_MESSAGE_LEN, "unknown node type: %d", node);
154
+ return msg;
155
+ }
156
+ }
157
+ };
158
+ EOF
159
+ end
160
+
161
+ File.open("node_types.hpp", "wb") do |f|
162
+ f.puts <<EOF
163
+ #ifndef MEL_NODE_TYPES_HPP
164
+ #define MEL_NODE_TYPES_HPP
165
+ /* This file is generated by node_types.rb. Do not edit. */
166
+
167
+ namespace MELBOURNE {
168
+ enum node_type {
169
+ EOF
170
+
171
+ f.puts list.map { |x| " NODE_#{x.upcase}" }.join(",\n")
172
+
173
+ f.puts <<EOF
174
+ };
175
+
176
+ const char *get_node_type_string(enum node_type nt);
177
+
178
+ };
179
+
180
+ #endif
181
+ EOF
182
+ end
183
+ end
184
+
185
+ write_node_types node_types