summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-03 07:57:29 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-09-03 07:57:29 +0000
commit0eeed6cf05ab82fd0e6a72dbdde1948ade809b34 (patch)
tree89e1596798e37e57131fa6a4ee4727e86862763f
parentdfb8ca93a312676b55f693bb8489ececb293c2bc (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--ChangeLog6
-rw-r--r--NEWS12
-rw-r--r--parse.y10
3 files changed, 26 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ef67232b3c..07197a9128 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index 0a206d72c2..385a4a2b67 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/parse.y b/parse.y
index 0752cd1852..0dcc554e51 100644
--- a/parse.y
+++ b/parse.y
@@ -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);