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

* parse.y (yylex): should pushback proper char after '<<'.

* parse.y (range_op, cond0, cond): get rid of doubled warnings.

* parse.y (value_expr): reduce recursion level.

* parse.y (logop): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2002-06-18 03:53:23 +00:00
parent 9c44d6a05c
commit 12c00312aa
3 changed files with 66 additions and 39 deletions

View file

@ -1,3 +1,13 @@
Tue Jun 18 12:50:17 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* parse.y (yylex): should pushback proper char after '<<'.
* parse.y (range_op, cond0, cond): get rid of doubled warnings.
* parse.y (value_expr): reduce recursion level.
* parse.y (logop): ditto.
Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* dln.c (dln_load): need to preserve dln_strerror() result,

35
parse.y
View file

@ -3215,7 +3215,7 @@ yylex()
return tLEQ;
}
if (c == '<') {
if (nextc() == '=') {
if ((c = nextc()) == '=') {
lex_state = EXPR_BEG;
yylval.id = tLSHFT;
return tOP_ASGN;
@ -4643,8 +4643,7 @@ static int
value_expr(node)
NODE *node;
{
if (node == 0) return Qtrue;
while (node) {
switch (nd_type(node)) {
case NODE_CLASS:
case NODE_MODULE:
@ -4666,24 +4665,33 @@ value_expr(node)
while (node->nd_next) {
node = node->nd_next;
}
return value_expr(node->nd_head);
node = node->nd_head;
break;
case NODE_BEGIN:
return value_expr(node->nd_body);
node = node->nd_body;
break;
case NODE_IF:
return value_expr(node->nd_body) && value_expr(node->nd_else);
if (!value_expr(node->nd_body)) return Qfalse;
node = node->nd_else;
break;
case NODE_AND:
case NODE_OR:
return value_expr(node->nd_2nd);
node = node->nd_2nd;
break;
case NODE_NEWLINE:
return value_expr(node->nd_next);
node = node->nd_next;
break;
default:
return Qtrue;
}
}
return Qtrue;
}
static void
@ -4876,6 +4884,7 @@ range_op(node)
if (!e_option_supplied()) return node;
if (node == 0) return 0;
value_expr(node);
node = cond0(node);
type = nd_type(node);
if (type == NODE_NEWLINE) node = node->nd_next;
@ -4893,7 +4902,6 @@ cond0(node)
enum node_type type = nd_type(node);
assign_in_cond(node);
value_expr(node);
switch (type) {
case NODE_DSTR:
@ -4945,6 +4953,7 @@ cond(node)
NODE *node;
{
if (node == 0) return 0;
value_expr(node);
if (nd_type(node) == NODE_NEWLINE){
node->nd_next = cond0(node->nd_next);
return node;
@ -4958,6 +4967,14 @@ logop(type, left, right)
NODE *left, *right;
{
value_expr(left);
if (nd_type(left) == type) {
NODE *node = left, *second;
while ((second = node->nd_2nd) != 0 && nd_type(second) == type) {
node = second;
}
node->nd_2nd = rb_node_newnode(type, second, right, 0);
return left;
}
return rb_node_newnode(type, left, right, 0);
}

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.2"
#define RUBY_RELEASE_DATE "2002-06-17"
#define RUBY_RELEASE_DATE "2002-06-18"
#define RUBY_VERSION_CODE 172
#define RUBY_RELEASE_CODE 20020617
#define RUBY_RELEASE_CODE 20020618