rubinius-melbourne 1.2.1.0 → 2.0.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,152 @@
1
+ /* C code produced by gperf version 3.0.4 */
2
+ /* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */
3
+
4
+ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27
+ /* The character set is not based on ISO-646. */
28
+ error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
29
+ #endif
30
+
31
+ struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
32
+ const struct kwtable *rb_reserved_word(const char *, unsigned int);
33
+ static const struct kwtable *reserved_word(const char *, unsigned int);
34
+ #define rb_reserved_word(str, len) reserved_word(str, len)
35
+ struct kwtable;
36
+
37
+ #define TOTAL_KEYWORDS 41
38
+ #define MIN_WORD_LENGTH 2
39
+ #define MAX_WORD_LENGTH 12
40
+ #define MIN_HASH_VALUE 8
41
+ #define MAX_HASH_VALUE 50
42
+ /* maximum key range = 43, duplicates = 0 */
43
+
44
+ static inline unsigned int hash(register const char* str, register unsigned int len)
45
+ {
46
+ static const unsigned char asso_values[] =
47
+ {
48
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
49
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
50
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
52
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
53
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
54
+ 51, 51, 51, 26, 51, 51, 14, 51, 16, 8,
55
+ 11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
56
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
57
+ 51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
58
+ 4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
59
+ 5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
60
+ 24, 16, 51, 51, 51, 51, 51, 51, 51, 51,
61
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
62
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
63
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
64
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
65
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
66
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
67
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
68
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
69
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
70
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
71
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
72
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
73
+ 51, 51, 51, 51, 51, 51
74
+ };
75
+ register int hval = len;
76
+
77
+ switch (hval)
78
+ {
79
+ default:
80
+ hval += asso_values[(unsigned char)str[2]];
81
+ /*FALLTHROUGH*/
82
+ case 2:
83
+ case 1:
84
+ hval += asso_values[(unsigned char)str[0]];
85
+ break;
86
+ }
87
+ return hval + asso_values[(unsigned char)str[len - 1]];
88
+ }
89
+
90
+ const struct kwtable* rb_reserved_word(register const char* str, register unsigned int len)
91
+ {
92
+ static const struct kwtable wordlist[] =
93
+ {
94
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
95
+ {"break", {keyword_break, keyword_break}, EXPR_MID},
96
+ {"else", {keyword_else, keyword_else}, EXPR_BEG},
97
+ {"nil", {keyword_nil, keyword_nil}, EXPR_END},
98
+ {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
99
+ {"end", {keyword_end, keyword_end}, EXPR_END},
100
+ {"then", {keyword_then, keyword_then}, EXPR_BEG},
101
+ {"not", {keyword_not, keyword_not}, EXPR_ARG},
102
+ {"false", {keyword_false, keyword_false}, EXPR_END},
103
+ {"self", {keyword_self, keyword_self}, EXPR_END},
104
+ {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
105
+ {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
106
+ {"true", {keyword_true, keyword_true}, EXPR_END},
107
+ {"until", {keyword_until, modifier_until}, EXPR_VALUE},
108
+ {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
109
+ {"return", {keyword_return, keyword_return}, EXPR_MID},
110
+ {"def", {keyword_def, keyword_def}, EXPR_FNAME},
111
+ {"and", {keyword_and, keyword_and}, EXPR_VALUE},
112
+ {"do", {keyword_do, keyword_do}, EXPR_BEG},
113
+ {"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
114
+ {"for", {keyword_for, keyword_for}, EXPR_VALUE},
115
+ {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
116
+ {"or", {keyword_or, keyword_or}, EXPR_VALUE},
117
+ {"in", {keyword_in, keyword_in}, EXPR_VALUE},
118
+ {"when", {keyword_when, keyword_when}, EXPR_VALUE},
119
+ {"retry", {keyword_retry, keyword_retry}, EXPR_END},
120
+ {"if", {keyword_if, modifier_if}, EXPR_VALUE},
121
+ {"case", {keyword_case, keyword_case}, EXPR_VALUE},
122
+ {"redo", {keyword_redo, keyword_redo}, EXPR_END},
123
+ {"next", {keyword_next, keyword_next}, EXPR_MID},
124
+ {"super", {keyword_super, keyword_super}, EXPR_ARG},
125
+ {"module", {keyword_module, keyword_module}, EXPR_VALUE},
126
+ {"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
127
+ {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
128
+ {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
129
+ {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
130
+ {"END", {keyword_END, keyword_END}, EXPR_END},
131
+ {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
132
+ {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
133
+ {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
134
+ {"class", {keyword_class, keyword_class}, EXPR_CLASS},
135
+ {""}, {""},
136
+ {"while", {keyword_while, modifier_while}, EXPR_VALUE}
137
+ };
138
+
139
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
140
+ {
141
+ register int key = hash(str, len);
142
+
143
+ if(key <= MAX_HASH_VALUE && key >= 0)
144
+ {
145
+ register const char *s = wordlist[key].name;
146
+
147
+ if(*str == *s && !strcmp(str + 1, s + 1))
148
+ return &wordlist[key];
149
+ }
150
+ }
151
+ return 0;
152
+ }
@@ -10,10 +10,7 @@ extern "C" {
10
10
  VALUE MELBOURNE_STRING_TO_AST(VALUE self, VALUE source, VALUE name, VALUE line) {
11
11
  StringValue(source);
12
12
  StringValue(name);
13
- bstring b_str = blk2bstr(RSTRING_PTR(source), (int)RSTRING_LEN(source));
14
- VALUE result = MELBOURNE::string_to_ast(self,
15
- RSTRING_PTR(name), b_str, FIX2INT(line));
16
- bdestroy(b_str);
13
+ VALUE result = MELBOURNE::string_to_ast(self, name, source, line);
17
14
 
18
15
  return result;
19
16
  }
@@ -21,28 +18,32 @@ VALUE MELBOURNE_STRING_TO_AST(VALUE self, VALUE source, VALUE name, VALUE line)
21
18
  VALUE MELBOURNE_FILE_TO_AST(VALUE self, VALUE fname, VALUE start) {
22
19
  StringValue(fname);
23
20
 
24
- char* c_name = RSTRING_PTR(fname);
25
-
26
- FILE *file = fopen(c_name, "r");
27
- if(file) {
21
+ int fd = open(RSTRING_PTR(fname), O_RDONLY);
22
+ if(fd != -1) {
28
23
  VALUE result = MELBOURNE::file_to_ast(self,
29
- RSTRING_PTR(fname), file, FIX2INT(start));
30
- fclose(file);
24
+ RSTRING_PTR(fname), fd, FIX2INT(start));
25
+ close(fd);
31
26
 
32
27
  return result;
33
28
  } else {
34
- rb_raise(rb_eLoadError, "%s -- %s", strerror(errno), c_name);
29
+ rb_raise(rb_eLoadError, "no such file to load -- %s", RSTRING_PTR(fname));
35
30
  return Qnil;
36
31
  }
37
32
  }
38
33
 
39
34
  void Init_melbourne(void) {
40
- VALUE rb_mCodeTools, rb_cMelbourne;
35
+ VALUE rb_cMelbourne, rb_mToolSet, rb_mTScurrent, rb_mTS;
41
36
 
42
37
  MELBOURNE::init_symbols();
43
38
 
44
- rb_mCodeTools = rb_const_get(rb_cObject, rb_intern("CodeTools"));
45
- rb_cMelbourne = rb_define_class_under(rb_mCodeTools, "Melbourne", rb_cObject);
39
+ #ifndef RUBINIUS
40
+ VALUE rb_mRubinius = rb_const_get(rb_cObject, rb_intern("Rubinius"));
41
+ #endif
42
+
43
+ rb_mToolSet = rb_const_get(rb_mRubinius, rb_intern("ToolSet"));
44
+ rb_mTScurrent = rb_funcall(rb_mToolSet, rb_intern("current"), 0);
45
+ rb_mTS = rb_define_module_under(rb_mTScurrent, "TS");
46
+ rb_cMelbourne = rb_define_class_under(rb_mTS, "Melbourne", rb_cObject);
46
47
  rb_define_method(rb_cMelbourne, "string_to_ast",
47
48
  RUBY_METHOD_FUNC(MELBOURNE_STRING_TO_AST), 3);
48
49
  rb_define_method(rb_cMelbourne, "file_to_ast",
@@ -5,6 +5,7 @@
5
5
  #include <strings.h>
6
6
  #include <stdbool.h>
7
7
  #include <stdint.h>
8
+ #include <stdarg.h>
8
9
  #include <assert.h>
9
10
  #include <stdlib.h>
10
11
  #include <unistd.h>
@@ -14,55 +14,50 @@
14
14
  #define MEL_NODE_HPP
15
15
 
16
16
  #include "namespace.h"
17
- #include "bstrlib.h"
18
17
  #include "melbourne.hpp"
19
- #include "quark.hpp"
20
18
 
21
19
  namespace MELBOURNE {
22
20
 
23
- #define QUID quark
24
-
25
21
  typedef struct RNode {
26
22
  unsigned long flags;
27
23
  char *nd_file;
28
24
  union {
29
25
  RNode *node;
30
- QUID id;
26
+ ID id;
31
27
  VALUE value;
32
- QUID *tbl;
33
- bstring string;
28
+ ID *tbl;
34
29
  } u1;
35
30
  union {
36
31
  struct RNode *node;
37
- QUID id;
32
+ ID id;
38
33
  long argc;
39
34
  VALUE value;
40
35
  } u2;
41
36
  union {
42
37
  struct RNode *node;
43
- QUID id;
38
+ ID id;
44
39
  long state;
45
40
  long cnt;
46
41
  VALUE value;
47
- bstring string;
48
42
  } u3;
49
43
  } NODE;
50
44
 
51
45
  #define RNODE(obj) ((NODE*)(obj))
52
46
 
53
- #ifndef FL_USHIFT
54
- #define FL_USHIFT 11
55
- #endif
47
+ /* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
48
+ #define NODE_FL_NEWLINE (((VALUE)1)<<7)
49
+ #define NODE_FL_CREF_PUSHED_BY_EVAL NODE_FL_NEWLINE
56
50
 
57
- #define FL_UMASK (0xff<<FL_USHIFT)
51
+ #define NODE_TYPESHIFT 8
52
+ #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
58
53
 
59
- #define nd_type(n) ((int)(((RNODE(n))->flags>>FL_USHIFT)&0xff))
54
+ #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
60
55
  #define nd_set_type(n,t) \
61
- RNODE(n)->flags=((RNODE(n)->flags&~FL_UMASK)|(((t)<<FL_USHIFT)&FL_UMASK))
56
+ RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
62
57
 
63
- #define NODE_LSHIFT (FL_USHIFT+8)
64
- #define NODE_LMASK (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
65
- #define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
58
+ #define NODE_LSHIFT (NODE_TYPESHIFT+7)
59
+ #define NODE_LMASK (((intptr_t)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
60
+ #define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
66
61
  #define nd_set_line(n,l) \
67
62
  RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
68
63
 
@@ -74,7 +69,7 @@ namespace MELBOURNE {
74
69
  #define nd_body u2.node
75
70
  #define nd_else u3.node
76
71
 
77
- #define nd_orig u3.string
72
+ #define nd_orig u3.value
78
73
 
79
74
  #define nd_resq u2.node
80
75
  #define nd_ensr u3.node
@@ -89,21 +84,20 @@ namespace MELBOURNE {
89
84
  #define nd_cflag u2.id
90
85
  #define nd_cval u3.value
91
86
 
87
+ #define nd_oid u1.id
92
88
  #define nd_cnt u3.cnt
93
89
  #define nd_tbl u1.tbl
94
90
 
95
91
  #define nd_var u1.node
96
- #define nd_ibdy u2.node
97
92
  #define nd_iter u3.node
98
93
 
99
94
  #define nd_value u2.node
100
95
  #define nd_aid u3.id
101
96
 
102
- #define nd_str u1.string
103
97
  #define nd_lit u1.value
104
98
 
105
- #define nd_frml u1.node
106
- #define nd_rest u2.argc
99
+ #define nd_frml u2.argc
100
+ #define nd_rest u1.id
107
101
  #define nd_opt u1.node
108
102
  #define nd_pid u1.id
109
103
  #define nd_plen u2.argc
@@ -112,12 +106,9 @@ namespace MELBOURNE {
112
106
  #define nd_mid u2.id
113
107
  #define nd_args u3.node
114
108
 
115
- #define nd_noex u1.id
109
+ #define nd_noex u3.id
116
110
  #define nd_defn u3.node
117
111
 
118
- #define nd_old u1.id
119
- #define nd_new u2.id
120
-
121
112
  #define nd_cfnc u1.cfunc
122
113
  #define nd_argc u2.argc
123
114
 
@@ -137,14 +128,30 @@ namespace MELBOURNE {
137
128
  #define nd_tag u1.id
138
129
  #define nd_tval u2.value
139
130
 
131
+ #define nd_visi u2.argc
132
+
133
+ #undef NEW_NODE
134
+ #undef REF
135
+
140
136
  #define NEW_NODE(t,a0,a1,a2) node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
141
137
 
142
- #define NEW_METHOD(n,x) NEW_NODE(NODE_METHOD,x,n,0)
143
- #define NEW_FBODY(n,i,o) NEW_NODE(NODE_FBODY,n,i,o)
144
- #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,p,i,NEW_RFUNC(a,d))
145
- #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_RFUNC(a,d))
146
- #define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(vps, b1,b2))
147
- #define NEW_SCOPE(b) NEW_NODE(NODE_SCOPE,mel_local_tbl(vps),0,(b))
138
+ #ifdef RUBINIUS
139
+ /* In Rubinius, the object references are handles and the handle
140
+ * in the native method frame keeps the object from being collected.
141
+ */
142
+ #define REF(n) (n)
143
+ #else
144
+ /* In MRI, we are holding references to objects in memory that the
145
+ * MRI GC does not see. To keep these objects from being collected,
146
+ * we add a reference to them to an Array that MRI GC does see.
147
+ */
148
+ #define REF(n) node_add_reference(n)
149
+ #endif
150
+
151
+ #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
152
+ #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
153
+ #define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
154
+ #define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
148
155
  #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
149
156
  #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
150
157
  #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
@@ -154,7 +161,8 @@ namespace MELBOURNE {
154
161
  #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
155
162
  #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
156
163
  #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
157
- #define NEW_ITER(v,i,b) NEW_NODE(NODE_ITER,v,b,i)
164
+ #define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
165
+ #define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,0,0)
158
166
  #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
159
167
  #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
160
168
  #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
@@ -169,92 +177,93 @@ namespace MELBOURNE {
169
177
  #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
170
178
  #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
171
179
  #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
172
- #define NEW_POSITIONAL(a) NEW_NODE(NODE_HASH,a,1,0)
173
- #define NEW_NOT(a) NEW_NODE(NODE_NOT,0,a,0)
174
180
  #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
175
181
  #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,0)
176
- #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,local_cnt(v))
182
+ #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
177
183
  #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
178
184
  #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
179
185
  #define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
186
+ #define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
180
187
  #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
181
188
  #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
182
189
  #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
183
190
  #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
184
191
  #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
185
- #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset((rb_parser_state*) parser_state, i))
192
+ #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
186
193
  #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
187
194
  #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
188
195
  #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,0)
189
- #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,local_cnt(v))
196
+ #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
190
197
  #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
191
198
  #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
192
199
  #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
193
200
  #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
194
- #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,local_cnt('~'))
195
- #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,local_cnt('~'))
201
+ #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
202
+ #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
196
203
  #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
197
204
  #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
198
205
  #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
199
206
  #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
200
- #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
201
- #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
202
- #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
203
- #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
204
- #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
207
+ #define NEW_STR(s) NEW_NODE(NODE_STR,REF(s),0,0)
208
+ #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,REF(s),1,0)
209
+ #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,REF(s),0,0)
210
+ #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,REF(s),0,0)
211
+ #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,REF(s),0,0)
205
212
  #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
206
- #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
207
- #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
208
- #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
213
+ #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,convert_op(m),a)
214
+ #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,convert_op(m),a)
215
+ #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,convert_op(m),0)
209
216
  #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
210
217
  #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
211
- #define NEW_ARGS(f,o,r) NEW_NODE(NODE_ARGS,o,r,f)
218
+ #define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
219
+ #define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
220
+ #define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
221
+ #define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
212
222
  #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
213
223
  #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
214
224
  #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
215
225
  #define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
216
- #define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0)
217
226
  #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
218
227
  #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
219
- #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,o,n,0)
220
- #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,o,n,0)
228
+ #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
229
+ #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
221
230
  #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
222
- #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(b),(s))
223
- #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0)
224
- #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
231
+ #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
232
+ #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
233
+ #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
225
234
  #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
226
235
  #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
227
- #define NEW_CREF(c) (NEW_NODE(NODE_CREF,0,0,c))
228
236
  #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
229
237
  #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
230
- #define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
231
238
  #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
232
239
  #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
233
240
  #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
234
241
  #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
242
+ #define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
235
243
  #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
236
- #define NEW_NEWLINE(n) NEW_NODE(NODE_NEWLINE,0,0,n)
237
- #define NEW_PREEXE(b) NEW_NODE(NODE_PREEXE,0,0,0)
238
- #define NEW_POSTEXE() NEW_NODE(NODE_POSTEXE,0,0,0)
239
- #define NEW_DMETHOD(b) NEW_NODE(NODE_DMETHOD,0,0,b)
244
+ #define NEW_PREEXE(b) NEW_NODE(NODE_PREEXE,0,b,0)
245
+ #define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
240
246
  #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
241
247
  #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
242
- #define NEW_FIXNUM(l) NEW_NODE(NODE_FIXNUM,0,0,l)
243
- #define NEW_NUMBER(l) NEW_NODE(NODE_NUMBER,l,0,0)
244
- #define NEW_HEXNUM(l) NEW_NODE(NODE_HEXNUM,l,0,0)
245
- #define NEW_OCTNUM(l) NEW_NODE(NODE_OCTNUM,l,0,0)
246
- #define NEW_BINNUM(l) NEW_NODE(NODE_BINNUM,l,0,0)
247
- #define NEW_FLOAT(l) NEW_NODE(NODE_FLOAT,l,0,0)
248
- #define NEW_NEGATE(l) NEW_NODE(NODE_NEGATE,l,0,0)
249
- #define NEW_REGEX(l,o) NEW_NODE(NODE_REGEX,l,0,o)
248
+ #define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
249
+ #define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
250
+ #define NEW_REGEX(l,o) NEW_NODE(NODE_REGEX,REF(l),0,o)
250
251
  #define NEW_FILE() NEW_NODE(NODE_FILE,0,0,0)
251
- #define NOEX_PUBLIC 0
252
- #define NOEX_NOSUPER 1
253
- #define NOEX_PRIVATE 2
254
- #define NOEX_PROTECTED 4
255
- #define NOEX_MASK 6
256
-
257
- #define NOEX_UNDEF NOEX_NOSUPER
252
+ #define NEW_NUMBER(l) NEW_NODE(NODE_NUMBER,REF(l),0,0)
253
+ #define NEW_FLOAT(l) NEW_NODE(NODE_FLOAT,REF(l),0,0)
254
+ #define NEW_ENCODING(n) NEW_NODE(NODE_ENCODING,REF(n),0,0)
255
+
256
+ #define NOEX_PUBLIC 0x00,
257
+ #define NOEX_NOSUPER 0x01,
258
+ #define NOEX_PRIVATE 0x02,
259
+ #define NOEX_PROTECTED 0x04,
260
+ #define NOEX_MASK 0x06,
261
+ #define NOEX_BASIC 0x08,
262
+ #define NOEX_UNDEF NOEX_NOSUPER,
263
+ #define NOEX_MODFUNC 0x12,
264
+ #define NOEX_SUPER 0x20,
265
+ #define NOEX_VCALL 0x40,
266
+ #define NOEX_RESPONDS 0x80
258
267
 
259
268
  };
260
269