ruby-changes:49857
From: nobu <ko1@a...>
Date: Sat, 20 Jan 2018 14:39:12 +0900 (JST)
Subject: [ruby-changes:49857] nobu:r61975 (trunk): dsl.rb: ID constants
nobu 2018-01-20 14:39:02 +0900 (Sat, 20 Jan 2018) New Revision: 61975 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61975 Log: dsl.rb: ID constants * ext/ripper/tools/dsl.rb (DSL#method_missing): expand ID constnats without parentheses. Modified files: trunk/ext/ripper/tools/dsl.rb trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61974) +++ parse.y (revision 61975) @@ -1646,7 +1646,7 @@ lhs : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1646 /*%%%*/ $$ = attrset(p, $1, idCOLON2, $3, &@$); /*% %*/ - /*% ripper: field!($1, "ID2VAL(idCOLON2)", $3) %*/ + /*% ripper: field!($1, ID2VAL(idCOLON2), $3) %*/ } | primary_value call_op tCONSTANT { @@ -3613,7 +3613,7 @@ numeric : simple_numeric https://github.com/ruby/ruby/blob/trunk/parse.y#L3613 $$ = $2; add_mark_object(p, $$->nd_lit = negate_lit(p, $$->nd_lit)); /*% %*/ - /*% ripper: unary!("ID2VAL(idUMinus)", $2) %*/ + /*% ripper: unary!(ID2VAL(idUMinus), $2) %*/ } ; Index: ext/ripper/tools/dsl.rb =================================================================== --- ext/ripper/tools/dsl.rb (revision 61974) +++ ext/ripper/tools/dsl.rb (revision 61975) @@ -43,6 +43,8 @@ class DSL https://github.com/ruby/ruby/blob/trunk/ext/ripper/tools/dsl.rb#L43 event = $` @events[event] = args.size "dispatch#{ args.size }(#{ [event, *args].join(", ") })" + elsif args.empty? and /\Aid[A-Z]/ =~ event.to_s + event else "#{ event }(#{ args.join(", ") })" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/