* parse.y (value_expr_gen): fix to cause "void value expression"

when jump expression such as "next" are shown on value_expr().
  [ruby-dev:31119]
* bootstraptest/test_syntax.rb: fix to above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-08-06 07:46:57 +00:00
Родитель 1a30041536
Коммит 1951ef76ce
3 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Mon Aug 6 16:41:22 2007 Koichi Sasada <ko1@atdot.net>
* parse.y (value_expr_gen): fix to cause "void value expression"
when jump expression such as "next" are shown on value_expr().
[ruby-dev:31119]
* bootstraptest/test_syntax.rb: fix to above change.
Mon Aug 6 14:36:30 2007 Koichi Sasada <ko1@atdot.net>
* parse.y: fix a f_marg rule. [ruby-dev:31160]

Просмотреть файл

@ -538,8 +538,8 @@ assert_equal %q{0}, %q{[*0];0} # [ruby-dev:31102]
assert_syntax_error "syntax error, unexpected ')'", %q{v0,(*,v1,) = 0} # [ruby-dev:31104]
assert_equal %q{1}, %q{class << (ary=[]); def []; 0; end; def []=(x); super(0,x);end;end; ary[]+=1} # [ruby-dev:31110]
assert_syntax_error "Can't set variable $1", %q{0..$1=1} # [ruby-dev:31118]
assert_equal %q{1}, %q{1.times{1+(1&&next)}} # [ruby-dev:31119]
assert_equal %q{1}, %q{x=-1;loop{x+=1&&redo if (x+=1).zero?}} # [ruby-dev:31119]
assert_syntax_error "void value expression", %q{1.times{1+(1&&next)}} # [ruby-dev:31119]
assert_syntax_error "void value expression", %q{x=-1;loop{x+=1&&redo if (x+=1).zero?}} # [ruby-dev:31119]
assert_syntax_error %q{syntax error, unexpected $end}, %q{!} # [ruby-dev:31243]
assert_equal %q{[nil]}, %q{[()]} # [ruby-dev:31252]
assert_equal %q{true}, %q{!_=()} # [ruby-dev:31263]

Просмотреть файл

@ -7447,8 +7447,6 @@ node_assign_gen(struct parser_params *parser, NODE *lhs, NODE *rhs)
static int
value_expr_gen(struct parser_params *parser, NODE *node)
{
int cond = 0;
if (!node) {
rb_warning0("empty expression");
}
@ -7464,7 +7462,7 @@ value_expr_gen(struct parser_params *parser, NODE *node)
case NODE_NEXT:
case NODE_REDO:
case NODE_RETRY:
if (!cond) yyerror("void value expression");
yyerror("void value expression");
/* or "control never reach"? */
return Qfalse;
@ -7486,7 +7484,6 @@ value_expr_gen(struct parser_params *parser, NODE *node)
case NODE_AND:
case NODE_OR:
cond = 1;
node = node->nd_2nd;
break;