1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (primary): make functional-style not operator to act

like function.  see <http://d.hatena.ne.jp/ku-ma-me/20080624/p1>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-06-25 12:55:47 +00:00
parent d02ef8342c
commit 89080e0254
5 changed files with 21 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Wed Jun 25 21:54:34 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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@ruby-lang.org>
* array.c (rb_ary_fill): not depend on unspecified behavior at integer

View file

@ -31,7 +31,7 @@ in, {keyword_in, keyword_in}, EXPR_VALUE
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

View file

@ -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,6 +101,9 @@ hash (str, len)
#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif
const struct kwtable *
rb_reserved_word (str, len)
@ -123,7 +126,7 @@ rb_reserved_word (str, len)
#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"

View file

@ -31,7 +31,7 @@ in, {keyword_in, keyword_in}, EXPR_VALUE
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

View file

@ -2613,6 +2613,14 @@ primary : literal
$$ = dispatch1(defined, $5);
%*/
}
| keyword_not '(' expr rparen
{
/*%%%*/
$$ = call_uni_op(cond($3), '!');
/*%
$$ = dispatch2(unary, ripper_intern("not"), $3);
%*/
}
| operation brace_block
{
/*%%%*/