diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-03 07:57:29 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-03 07:57:29 +0000 |
commit | 0eeed6cf05ab82fd0e6a72dbdde1948ade809b34 (patch) | |
tree | 89e1596798e37e57131fa6a4ee4727e86862763f | |
parent | dfb8ca93a312676b55f693bb8489ececb293c2bc (diff) |
* parse.y (method_call): Add support for Ruby 1.9 style method
invocation syntax f.(x) / f::(x), which is interpreted as
f.call(x).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 12 | ||||
-rw-r--r-- | parse.y | 10 |
3 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Fri Sep 3 16:42:59 2010 Akinori MUSHA <[email protected]> + + * parse.y (method_call): Add support for Ruby 1.9 style method + invocation syntax f.(x) / f::(x), which is interpreted as + f.call(x). + Fri Sep 3 12:40:54 2010 Nobuyoshi Nakada <[email protected]> * intern.h (rb_usascii_str_new): macros for forward compatibility. @@ -17,8 +17,16 @@ with all sufficient information, see the ChangeLog file. * new hash immediates - Ruby 1.9 style hash syntax e.g. { key: value } is now also supported - in 1.8. You can also write a method invocation syntax foo bar: baz. + Ruby 1.9 style hash syntax e.g. { key: value } is now supported. + Just like the normal hash syntax, you can put key-value pairs + without enclosing parentheses at the end of a method argument list. + e.g. some_method foo: 1, bar: 2 + +* new method invocation syntax + + Ruby 1.9 style special method invocation syntax f.(x), which is + equivalent to f.call(x), is supported. This is mainly for use + in invoking a Proc. === Configuration changes @@ -1900,6 +1900,16 @@ method_call : operation paren_args { $$ = new_call($1, $3, 0); } + | primary_value '.' paren_args + { + $$ = new_call($1, rb_intern("call"), $3); + fixpos($$, $1); + } + | primary_value tCOLON2 paren_args + { + $$ = new_call($1, rb_intern("call"), $3); + fixpos($$, $1); + } | kSUPER paren_args { $$ = new_super($2); |