ruby-changes:6063
From: matz <ko1@a...>
Date: Wed, 25 Jun 2008 21:56:18 +0900 (JST)
Subject: [ruby-changes:6063] Ruby:r17573 (trunk): * parse.y (primary): make functional-style not operator to act
matz 2008-06-25 21:55:47 +0900 (Wed, 25 Jun 2008) New Revision: 17573 Modified files: trunk/ChangeLog trunk/keywords trunk/lex.c.blt trunk/lex.c.src trunk/parse.y Log: * parse.y (primary): make functional-style not operator to act like function. see <http://d.hatena.ne.jp/ku-ma-me/20080624/p1>. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=17573&r2=17572&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lex.c.blt?r1=17573&r2=17572&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17573&r2=17572&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/keywords?r1=17573&r2=17572&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lex.c.src?r1=17573&r2=17572&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 17572) +++ ChangeLog (revision 17573) @@ -1,3 +1,8 @@ +Wed Jun 25 21:54:34 2008 Yukihiro Matsumoto <matz@r...> + + * parse.y (primary): make functional-style not operator to act + like function. see <http://d.hatena.ne.jp/ku-ma-me/20080624/p1>. + Wed Jun 25 15:28:50 2008 Nobuyoshi Nakada <nobu@r...> * array.c (rb_ary_fill): not depend on unspecified behavior at integer Index: lex.c.blt =================================================================== --- lex.c.blt (revision 17572) +++ lex.c.blt (revision 17573) @@ -1,5 +1,5 @@ -/* C code produced by gperf version 3.0.2 */ -/* Command-line: gperf --output-file=lex.c.tmp -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' keywords */ +/* C code produced by gperf version 3.0.3 */ +/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' keywords */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ @@ -101,7 +101,10 @@ #ifdef __GNUC__ __inline +#ifdef __GNUC_STDC_INLINE__ +__attribute__ ((__gnu_inline__)) #endif +#endif const struct kwtable * rb_reserved_word (str, len) register const char *str; @@ -123,7 +126,7 @@ #line 42 "keywords" {"then", {keyword_then, keyword_then}, EXPR_BEG}, #line 34 "keywords" - {"not", {keyword_not, keyword_not}, EXPR_VALUE}, + {"not", {keyword_not, keyword_not}, EXPR_ARG}, #line 27 "keywords" {"false", {keyword_false, keyword_false}, EXPR_END}, #line 40 "keywords" Index: lex.c.src =================================================================== --- lex.c.src (revision 17572) +++ lex.c.src (revision 17573) @@ -31,7 +31,7 @@ module, {keyword_module, keyword_module}, EXPR_VALUE next, {keyword_next, keyword_next}, EXPR_MID nil, {keyword_nil, keyword_nil}, EXPR_END -not, {keyword_not, keyword_not}, EXPR_VALUE +not, {keyword_not, keyword_not}, EXPR_ARG or, {keyword_or, keyword_or}, EXPR_VALUE redo, {keyword_redo, keyword_redo}, EXPR_END rescue, {keyword_rescue, modifier_rescue}, EXPR_MID Index: parse.y =================================================================== --- parse.y (revision 17572) +++ parse.y (revision 17573) @@ -2613,6 +2613,14 @@ $$ = dispatch1(defined, $5); %*/ } + | keyword_not '(' expr rparen + { + /*%%%*/ + $$ = call_uni_op(cond($3), '!'); + /*% + $$ = dispatch2(unary, ripper_intern("not"), $3); + %*/ + } | operation brace_block { /*%%%*/ Index: keywords =================================================================== --- keywords (revision 17572) +++ keywords (revision 17573) @@ -31,7 +31,7 @@ module, {keyword_module, keyword_module}, EXPR_VALUE next, {keyword_next, keyword_next}, EXPR_MID nil, {keyword_nil, keyword_nil}, EXPR_END -not, {keyword_not, keyword_not}, EXPR_VALUE +not, {keyword_not, keyword_not}, EXPR_ARG or, {keyword_or, keyword_or}, EXPR_VALUE redo, {keyword_redo, keyword_redo}, EXPR_END rescue, {keyword_rescue, modifier_rescue}, EXPR_MID -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/