Skip to content

Commit

Permalink
* parse.y (primary): make functional-style not operator to act
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
matz committed Jun 25, 2008
1 parent d02ef83 commit 89080e0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion keywords
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions lex.c.blt
Original file line number Diff line number Diff line change
@@ -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) \
Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lex.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/*%%%*/
Expand Down

0 comments on commit 89080e0

Please sign in to comment.