ruby-changes:40203
From: nobu <ko1@a...>
Date: Mon, 26 Oct 2015 17:12:10 +0900 (JST)
Subject: [ruby-changes:40203] nobu:r52284 (trunk): parse.y: fix ripper
nobu 2015-10-26 17:11:55 +0900 (Mon, 26 Oct 2015) New Revision: 52284 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52284 Log: parse.y: fix ripper * parse.y (call_op, call_op2): fix values on ripper. [Feature #11537] Modified files: trunk/ChangeLog trunk/parse.y trunk/template/id.h.tmpl Index: ChangeLog =================================================================== --- ChangeLog (revision 52283) +++ ChangeLog (revision 52284) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Oct 26 17:11:53 2015 Nobuyoshi Nakada <nobu@r...> + + * parse.y (call_op, call_op2): fix values on ripper. [Feature #11537] + Mon Oct 26 12:55:06 2015 Nobuyoshi Nakada <nobu@r...> * parse.y (call_op2): separate from call_op and also allow "::", Index: parse.y =================================================================== --- parse.y (revision 52283) +++ parse.y (revision 52284) @@ -1466,7 +1466,7 @@ command : fcall command_args %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1466 $$ = NEW_QCALL($2, $1, $3, $4); fixpos($$, $1); /*% - $$ = dispatch4(command_call, $1, ripper_id2sym($2), $3, $4); + $$ = dispatch4(command_call, $1, $2, $3, $4); %*/ } | primary_value call_op operation2 command_args cmd_brace_block @@ -1477,7 +1477,7 @@ command : fcall command_args %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1477 $$ = $5; fixpos($$, $1); /*% - $$ = dispatch4(command_call, $1, ripper_id2sym($2), $3, $4); + $$ = dispatch4(command_call, $1, $2, $3, $4); $$ = method_add_block($$, $5); %*/ } @@ -1722,7 +1722,7 @@ mlhs_node : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1722 /*%%%*/ $$ = attrset($1, $2, $3); /*% - $$ = dispatch3(field, $1, ripper_id2sym($2), $3); + $$ = dispatch3(field, $1, $2, $3); %*/ } | primary_value tCOLON2 tIDENTIFIER @@ -1738,7 +1738,7 @@ mlhs_node : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1738 /*%%%*/ $$ = attrset($1, $2, $3); /*% - $$ = dispatch3(field, $1, ripper_id2sym($2), $3); + $$ = dispatch3(field, $1, $2, $3); %*/ } | primary_value tCOLON2 tCONSTANT @@ -1813,7 +1813,7 @@ lhs : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1813 /*%%%*/ $$ = attrset($1, $2, $3); /*% - $$ = dispatch3(field, $1, ripper_id2sym($2), $3); + $$ = dispatch3(field, $1, $2, $3); %*/ } | primary_value tCOLON2 tIDENTIFIER @@ -1829,7 +1829,7 @@ lhs : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1829 /*%%%*/ $$ = attrset($1, $2, $3); /*% - $$ = dispatch3(field, $1, ripper_id2sym($2), $3); + $$ = dispatch3(field, $1, $2, $3); %*/ } | primary_value tCOLON2 tCONSTANT @@ -3664,7 +3664,7 @@ method_call : fcall paren_args https://github.com/ruby/ruby/blob/trunk/parse.y#L3664 $$ = NEW_QCALL($2, $1, $3, $5); nd_set_line($$, $<num>4); /*% - $$ = dispatch3(call, $1, ripper_id2sym($2), $3); + $$ = dispatch3(call, $1, $2, $3); $$ = method_optarg($$, $5); %*/ } @@ -3704,8 +3704,7 @@ method_call : fcall paren_args https://github.com/ruby/ruby/blob/trunk/parse.y#L3704 $$ = NEW_QCALL($2, $1, idCall, $4); nd_set_line($$, $<num>3); /*% - $$ = dispatch3(call, $1, ripper_id2sym($2), - ID2SYM(idCall)); + $$ = dispatch3(call, $1, $2, ID2SYM(idCall)); $$ = method_optarg($$, $4); %*/ } @@ -5119,12 +5118,33 @@ dot_or_colon : '.' https://github.com/ruby/ruby/blob/trunk/parse.y#L5118 %*/ ; -call_op : '.' {$$ = '.';} - | tDOTQ {$$ = tDOTQ;} +call_op : '.' + { + /*%%%*/ + $$ = '.'; + /*% + $$ = ripper_id2sym('.'); + %*/ + } + | tDOTQ + { + /*%%%*/ + $$ = tDOTQ; + /*% + $$ = ripper_id2sym(idDOTQ); + %*/ + } ; call_op2 : call_op - | tCOLON2 {$$ = tCOLON2;} + | tCOLON2 + { + /*%%%*/ + $$ = tCOLON2; + /*% + $$ = ripper_id2sym(idCOLON2); + %*/ + } ; opt_terms : /* none */ Index: template/id.h.tmpl =================================================================== --- template/id.h.tmpl (revision 52283) +++ template/id.h.tmpl (revision 52284) @@ -92,6 +92,7 @@ enum ruby_method_ids { https://github.com/ruby/ruby/blob/trunk/template/id.h.tmpl#L92 idCOLON2 = RUBY_TOKEN(COLON2), idANDOP = RUBY_TOKEN(ANDOP), idOROP = RUBY_TOKEN(OROP), + idDOTQ = RUBY_TOKEN(DOTQ), tPRESERVED_ID_BEGIN = <%=op_id_offset + token_op_ids.size - 1%>, % ids[:preserved].each do |token| id<%=token%>, -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/