こんにちは、なかむら(う)です。
In message "[ruby-cvs:24798] Ruby:r17573 (trunk): * parse.y (primary): make functional-style not operator to act"
on Jun.25,2008 21:55:48, <matz / ruby-lang.org> wrote:
> matz 2008-06-25 21:55:47 +0900 (Wed, 25 Jun 2008)
>
> New Revision: 17573
(snip)
> Log:
> * parse.y (primary): make functional-style not operator to act
> like function. see <http://d.hatena.ne.jp/ku-ma-me/20080624/p1>.
遠藤さんに教えてもらったのですが、この変更で
not()
がパースエラーになるようになっています(従来はtrueを返す)。
修正してみました。
Index: parse.y
===================================================================
--- parse.y (revision 17573)
+++ parse.y (working copy)
@@ -2621,6 +2621,14 @@ primary : literal
$$ = dispatch2(unary, ripper_intern("not"), $3);
%*/
}
+ | keyword_not '(' rparen
+ {
+ /*%%%*/
+ $$ = call_uni_op(cond(NEW_NIL()), '!');
+ /*%
+ $$ = dispatch2(unary, ripper_intern("not"), Qnil);
+ %*/
+ }
| operation brace_block
{
/*%%%*/
それでは。
--
U.Nakamura <usa / garbagecollect.jp>