rubinius-melbourne 3.6 → 3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,4 +17,12 @@
17
17
 
18
18
  #define RSTRING_NOT_MODIFIED 1
19
19
 
20
+ #ifndef native_int
21
+ typedef intptr_t native_int;
22
+ #endif
23
+
24
+ #ifndef native_uint
25
+ typedef uintptr_t native_uint;
26
+ #endif
27
+
20
28
  #include "ruby.h"
@@ -208,8 +208,8 @@ namespace MELBOURNE {
208
208
  #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
209
209
  #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
210
210
  #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
211
- #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
212
- #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
211
+ #define NEW_OP_ASGN2(r,t,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o,t))
212
+ #define NEW_OP_ASGN22(i,o,t) NEW_NODE(NODE_OP_ASGN2,i,o,t)
213
213
  #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
214
214
  #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
215
215
  #define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
@@ -232,6 +232,9 @@ namespace MELBOURNE {
232
232
  #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,REF(s),0,0)
233
233
  #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
234
234
  #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,convert_op(m),a)
235
+ #define CALL_Q_P(q) ((q) == tANDDOT)
236
+ #define NODE_CALL_Q(q) (CALL_Q_P(q) ? NODE_QCALL : NODE_CALL)
237
+ #define NEW_QCALL(q,r,m,a) NEW_NODE(NODE_CALL_Q(q),r,convert_op(m),a)
235
238
  #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,convert_op(m),a)
236
239
  #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,convert_op(m),0)
237
240
  #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
@@ -266,6 +269,7 @@ namespace MELBOURNE {
266
269
  #define NEW_PREEXE(b) NEW_NODE(NODE_PREEXE,0,b,0)
267
270
  #define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
268
271
  #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
272
+ #define NEW_ANDATTRASGN(r,m,a) NEW_NODE(NODE_ANDATTRASGN,r,m,a)
269
273
  #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
270
274
  #define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
271
275
  #define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
@@ -45,6 +45,7 @@ namespace MELBOURNE {
45
45
  "call\0"
46
46
  "fcall\0"
47
47
  "vcall\0"
48
+ "qcall\0"
48
49
  "super\0"
49
50
  "zsuper\0"
50
51
  "array\0"
@@ -109,6 +110,7 @@ namespace MELBOURNE {
109
110
  "memo\0"
110
111
  "ifunc\0"
111
112
  "dsym\0"
113
+ "andattrasgn\0"
112
114
  "attrasgn\0"
113
115
  "prelude\0"
114
116
  "lambda\0"
@@ -165,86 +167,88 @@ namespace MELBOURNE {
165
167
  238,
166
168
  244,
167
169
  250,
168
- 257,
170
+ 256,
169
171
  263,
170
- 270,
171
- 277,
172
- 282,
173
- 289,
172
+ 269,
173
+ 276,
174
+ 283,
175
+ 288,
174
176
  295,
175
- 300,
176
- 305,
177
- 310,
178
- 315,
177
+ 301,
178
+ 306,
179
+ 311,
180
+ 316,
179
181
  321,
180
- 326,
181
- 334,
182
- 343,
182
+ 327,
183
+ 332,
184
+ 340,
183
185
  349,
184
- 356,
185
- 363,
186
- 367,
187
- 371,
188
- 376,
189
- 381,
186
+ 355,
187
+ 362,
188
+ 369,
189
+ 373,
190
+ 377,
191
+ 382,
190
192
  387,
191
193
  393,
192
194
  399,
193
- 410,
194
- 415,
195
- 424,
196
- 432,
197
- 439,
198
- 447,
199
- 455,
200
- 464,
195
+ 405,
196
+ 416,
197
+ 421,
198
+ 430,
199
+ 438,
200
+ 445,
201
+ 453,
202
+ 461,
201
203
  470,
202
- 477,
203
- 487,
204
- 498,
205
- 503,
206
- 508,
204
+ 476,
205
+ 483,
206
+ 493,
207
+ 504,
208
+ 509,
207
209
  514,
208
- 521,
210
+ 520,
209
211
  527,
210
212
  533,
211
- 540,
212
- 547,
213
- 554,
214
- 561,
215
- 566,
216
- 571,
213
+ 539,
214
+ 546,
215
+ 553,
216
+ 560,
217
+ 567,
218
+ 572,
217
219
  577,
218
220
  583,
219
- 588,
220
- 592,
221
- 597,
221
+ 589,
222
+ 594,
223
+ 598,
222
224
  603,
223
- 611,
224
- 619,
225
- 627,
226
- 634,
227
- 642,
228
- 647,
225
+ 609,
226
+ 617,
227
+ 625,
228
+ 633,
229
+ 640,
230
+ 648,
229
231
  653,
230
- 658,
231
- 667,
232
- 675,
233
- 682,
234
- 691,
235
- 696,
236
- 701,
237
- 707,
232
+ 659,
233
+ 664,
234
+ 676,
235
+ 685,
236
+ 693,
237
+ 700,
238
+ 709,
238
239
  714,
239
- 720,
240
- 729,
241
- 736,
242
- 745,
243
- 755
240
+ 719,
241
+ 725,
242
+ 732,
243
+ 738,
244
+ 747,
245
+ 754,
246
+ 763,
247
+ 773
244
248
  };
245
249
 
246
250
  const char *get_node_type_string(enum node_type node) {
247
- if(node < 115) {
251
+ if(node < 117) {
248
252
  return node_types + node_types_offsets[node];
249
253
  } else {
250
254
  #define NODE_STRING_MESSAGE_LEN 20
@@ -42,6 +42,7 @@ namespace MELBOURNE {
42
42
  NODE_CALL,
43
43
  NODE_FCALL,
44
44
  NODE_VCALL,
45
+ NODE_QCALL,
45
46
  NODE_SUPER,
46
47
  NODE_ZSUPER,
47
48
  NODE_ARRAY,
@@ -106,6 +107,7 @@ namespace MELBOURNE {
106
107
  NODE_MEMO,
107
108
  NODE_IFUNC,
108
109
  NODE_DSYM,
110
+ NODE_ANDATTRASGN,
109
111
  NODE_ATTRASGN,
110
112
  NODE_PRELUDE,
111
113
  NODE_LAMBDA,
@@ -37,6 +37,7 @@ node_types = %w[
37
37
  call
38
38
  fcall
39
39
  vcall
40
+ qcall
40
41
  super
41
42
  zsuper
42
43
  array
@@ -101,6 +102,7 @@ node_types = %w[
101
102
  memo
102
103
  ifunc
103
104
  dsym
105
+ andattrasgn
104
106
  attrasgn
105
107
  prelude
106
108
  lambda
@@ -23,7 +23,9 @@ namespace MELBOURNE {
23
23
  EXPR_FNAME_BIT, /* ignore newline, no reserved words. */
24
24
  EXPR_DOT_BIT, /* right after `.' or `::', no reserved words. */
25
25
  EXPR_CLASS_BIT, /* immediate after `class', no here document. */
26
- EXPR_VALUE_BIT, /* like EXPR_BEG but label is disallowed. */
26
+ EXPR_LABEL_BIT, /* flag bit, label is allowed. */
27
+ EXPR_LABELED_BIT, /* flag bit, just after a label. */
28
+ EXPR_FITEM_BIT, /* symbol literal as FNAME. */
27
29
  EXPR_MAX_STATE
28
30
  };
29
31
 
@@ -39,14 +41,19 @@ namespace MELBOURNE {
39
41
  EXPR(FNAME),
40
42
  EXPR(DOT),
41
43
  EXPR(CLASS),
42
- EXPR(VALUE),
43
- EXPR_BEG_ANY = (EXPR_BEG | EXPR_VALUE | EXPR_MID | EXPR_CLASS),
44
+ EXPR(LABEL),
45
+ EXPR(LABELED),
46
+ EXPR(FITEM),
47
+ EXPR_VALUE = EXPR_BEG,
48
+ EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS),
44
49
  EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
45
50
  EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN)
46
51
  };
47
52
 
48
- #define lex_state_of_p(x, s) ((x) & (s))
49
- #define lex_state_p(s) lex_state_of_p(lex_state, s)
53
+ #define lex_state_of_all_p(x, s) (((x) & (s)) == (s))
54
+ #define lex_state_of_p(x, s) ((x) & (s))
55
+ #define lex_state_p(s) lex_state_of_p(lex_state, s)
56
+ #define lex_state_all_p(s) lex_state_of_all_p(lex_state, s)
50
57
 
51
58
  typedef VALUE stack_type;
52
59
 
@@ -63,18 +70,22 @@ typedef VALUE stack_type;
63
70
  typedef struct rb_parser_state {
64
71
  int ruby__end__seen;
65
72
  int debug_lines;
66
- int heredoc_end;
67
73
  int command_start;
68
74
  NODE *lex_strterm;
69
75
  int paren_nest;
70
76
  int lpar_beg;
71
77
  int class_nest;
72
78
  int in_single;
79
+ int in_kwarg;
73
80
  int in_def;
74
81
  int brace_nest;
75
82
  int compile_for_eval;
76
83
  ID cur_mid;
84
+ int heredoc_end;
85
+ int heredoc_indent;
86
+ int heredoc_line_indent;
77
87
  char *token_buffer;
88
+ int token_seen;
78
89
  int tokidx;
79
90
  int toksiz;
80
91
  int tokline;
@@ -147,6 +158,8 @@ typedef VALUE stack_type;
147
158
  char *sourcefile;
148
159
  int sourceline;
149
160
 
161
+ ID current_arg;
162
+
150
163
  rb_encoding *enc;
151
164
  rb_encoding *utf8;
152
165
  } rb_parser_state;
@@ -165,11 +178,16 @@ typedef VALUE stack_type;
165
178
  #define lpar_beg PARSER_VAR(lpar_beg)
166
179
  #define class_nest PARSER_VAR(class_nest)
167
180
  #define in_single PARSER_VAR(in_single)
181
+ #define in_kwarg PARSER_VAR(in_kwarg)
168
182
  #define in_def PARSER_VAR(in_def)
169
183
  #define brace_nest PARSER_VAR(brace_nest)
170
184
  #define compile_for_eval PARSER_VAR(compile_for_eval)
171
185
  #define cur_mid PARSER_VAR(cur_mid)
186
+ #define heredoc_end PARSER_VAR(heredoc_end)
187
+ #define heredoc_indent PARSER_VAR(heredoc_indent)
188
+ #define heredoc_line_indent PARSER_VAR(heredoc_line_indent)
172
189
  #define tokenbuf PARSER_VAR(token_buffer)
190
+ #define token_seen PARSER_VAR(token_seen)
173
191
  #define tokidx PARSER_VAR(tokidx)
174
192
  #define toksiz PARSER_VAR(toksiz)
175
193
  #define tokline PARSER_VAR(tokline)
@@ -214,6 +232,7 @@ typedef VALUE stack_type;
214
232
  #define start_lines PARSER_VAR(start_lines)
215
233
  #define sourcefile PARSER_VAR(sourcefile)
216
234
  #define sourceline PARSER_VAR(sourceline)
235
+ #define current_arg PARSER_VAR(current_arg)
217
236
 
218
237
  #define node_newnode(t, a, b, c) \
219
238
  parser_node_newnode((rb_parser_state*)parser_state, t, a, b, c)
@@ -9,6 +9,7 @@ extern "C" {
9
9
  namespace MELBOURNE {
10
10
  ID rb_sAlias;
11
11
  ID rb_sAnd;
12
+ ID rb_sAndAttrAsgn;
12
13
  ID rb_sArgs;
13
14
  ID rb_sArgsCat;
14
15
  ID rb_sArgsPush;
@@ -86,6 +87,7 @@ namespace MELBOURNE {
86
87
  ID rb_sPostExe;
87
88
  ID rb_sPostArg;
88
89
  ID rb_sPreExe;
90
+ ID rb_sQCall;
89
91
  ID rb_sRational;
90
92
  ID rb_sRedo;
91
93
  ID rb_sRegex;
@@ -125,6 +127,7 @@ namespace MELBOURNE {
125
127
  void init_symbols() {
126
128
  rb_sAlias = rb_intern("process_alias");
127
129
  rb_sAnd = rb_intern("process_and");
130
+ rb_sAndAttrAsgn = rb_intern("process_andattrasgn");
128
131
  rb_sArgs = rb_intern("process_args");
129
132
  rb_sArgsCat = rb_intern("process_argscat");
130
133
  rb_sArgsPush = rb_intern("process_argspush");
@@ -202,6 +205,7 @@ namespace MELBOURNE {
202
205
  rb_sPostExe = rb_intern("process_postexe");
203
206
  rb_sPostArg = rb_intern("process_postarg");
204
207
  rb_sPreExe = rb_intern("process_preexe");
208
+ rb_sQCall = rb_intern("process_qcall");
205
209
  rb_sRational = rb_intern("process_rational");
206
210
  rb_sRedo = rb_intern("process_redo");
207
211
  rb_sRegex = rb_intern("process_regex");
@@ -8,6 +8,7 @@ extern "C" {
8
8
  namespace MELBOURNE {
9
9
  extern ID rb_sAlias;
10
10
  extern ID rb_sAnd;
11
+ extern ID rb_sAndAttrAsgn;
11
12
  extern ID rb_sArgs;
12
13
  extern ID rb_sArgsCat;
13
14
  extern ID rb_sArgsPush;
@@ -85,6 +86,7 @@ namespace MELBOURNE {
85
86
  extern ID rb_sPostExe;
86
87
  extern ID rb_sPostArg;
87
88
  extern ID rb_sPreExe;
89
+ extern ID rb_sQCall;
88
90
  extern ID rb_sRational;
89
91
  extern ID rb_sRedo;
90
92
  extern ID rb_sRegex;
@@ -416,6 +416,16 @@ namespace MELBOURNE {
416
416
  tree = rb_funcall(ptp, rb_sCall, 4, line, recv, ID2SYM(node->nd_mid), args);
417
417
  break;
418
418
  }
419
+ case NODE_QCALL: {
420
+ VALUE args = Qnil;
421
+
422
+ VALUE recv = process_parse_tree(parser_state, ptp, node->nd_recv, locals);
423
+ if (node->nd_args) {
424
+ args = process_parse_tree(parser_state, ptp, node->nd_args, locals);
425
+ }
426
+ tree = rb_funcall(ptp, rb_sQCall, 4, line, recv, ID2SYM(node->nd_mid), args);
427
+ break;
428
+ }
419
429
  case NODE_FCALL: {
420
430
  VALUE args = Qnil;
421
431
 
@@ -484,8 +494,9 @@ namespace MELBOURNE {
484
494
  op = ID2SYM(node->nd_next->nd_mid);
485
495
  }
486
496
  VALUE value = process_parse_tree(parser_state, ptp, node->nd_value, locals);
487
- tree = rb_funcall(ptp, rb_sOpAsgn2, 5, line,
488
- recv, ID2SYM(node->nd_next->nd_aid), op, value);
497
+ tree = rb_funcall(ptp, rb_sOpAsgn2, 6, line,
498
+ recv, node->nd_next->nd_aid ? Qtrue : Qfalse,
499
+ ID2SYM(node->nd_next->nd_oid), op, value);
489
500
  break;
490
501
  }
491
502
  case NODE_OP_ASGN_AND: {
@@ -971,6 +982,20 @@ namespace MELBOURNE {
971
982
  tree = rb_funcall(ptp, rb_sToAry, 2, line, expr);
972
983
  break;
973
984
  }
985
+ case NODE_ANDATTRASGN: { /* literal.meth = y u1 u2 u3 */
986
+ VALUE recv;
987
+
988
+ /* node id node */
989
+ if (node->nd_1st == RNODE(1)) {
990
+ recv = process_parse_tree(parser_state, ptp, NEW_SELF(), locals);
991
+ } else {
992
+ recv = process_parse_tree(parser_state, ptp, node->nd_1st, locals);
993
+ }
994
+ VALUE value = process_parse_tree(parser_state, ptp, node->nd_3rd, locals);
995
+ tree = rb_funcall(ptp, rb_sAndAttrAsgn, 4, line,
996
+ recv, ID2SYM(node->u2.id), value);
997
+ break;
998
+ }
974
999
  case NODE_ATTRASGN: { /* literal.meth = y u1 u2 u3 */
975
1000
  VALUE recv;
976
1001
 
@@ -1,5 +1,5 @@
1
1
  module CodeTools
2
2
  class Melbourne
3
- VERSION = "3.6"
3
+ VERSION = "3.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubinius-melbourne
3
3
  version: !ruby/object:Gem::Version
4
- version: '3.6'
4
+ version: '3.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcard
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  description: Ruby parser extracted from MRI.
@@ -92,17 +92,17 @@ require_paths:
92
92
  - lib
93
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.0.14.1
105
+ rubygems_version: 2.5.1
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Rubinius Ruby Parser.