summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-18 03:53:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-18 03:53:23 +0000
commit12c00312aaa4831f0ce820d9addce8f27c4f50b4 (patch)
tree8653a3663b86dc31c1f6aa5c5e4a85ad853e3301
parent9c44d6a05c26f252a46830a138f60c8c6dd6773c (diff)
* 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
-rw-r--r--ChangeLog10
-rw-r--r--parse.y89
-rw-r--r--version.h4
3 files changed, 65 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 9677b4988f..e43d4da8d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/parse.y b/parse.y
index e4f4627dc9..0aec9f1b3b 100644
--- a/parse.y
+++ b/parse.y
@@ -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,47 +4643,55 @@ static int
value_expr(node)
NODE *node;
{
- if (node == 0) return Qtrue;
+ while (node) {
+ switch (nd_type(node)) {
+ case NODE_CLASS:
+ case NODE_MODULE:
+ case NODE_DEFN:
+ case NODE_DEFS:
+ rb_warning("void value expression");
+ return Qfalse;
- switch (nd_type(node)) {
- case NODE_CLASS:
- case NODE_MODULE:
- case NODE_DEFN:
- case NODE_DEFS:
- rb_warning("void value expression");
- return Qfalse;
-
- case NODE_RETURN:
- case NODE_BREAK:
- case NODE_NEXT:
- case NODE_REDO:
- case NODE_RETRY:
- yyerror("void value expression");
- /* or "control never reach"? */
- return Qfalse;
-
- case NODE_BLOCK:
- while (node->nd_next) {
- node = node->nd_next;
- }
- return value_expr(node->nd_head);
+ case NODE_RETURN:
+ case NODE_BREAK:
+ case NODE_NEXT:
+ case NODE_REDO:
+ case NODE_RETRY:
+ yyerror("void value expression");
+ /* or "control never reach"? */
+ return Qfalse;
- case NODE_BEGIN:
- return value_expr(node->nd_body);
+ case NODE_BLOCK:
+ while (node->nd_next) {
+ node = node->nd_next;
+ }
+ node = node->nd_head;
+ break;
- case NODE_IF:
- return value_expr(node->nd_body) && value_expr(node->nd_else);
+ case NODE_BEGIN:
+ node = node->nd_body;
+ break;
- case NODE_AND:
- case NODE_OR:
- return value_expr(node->nd_2nd);
+ case NODE_IF:
+ if (!value_expr(node->nd_body)) return Qfalse;
+ node = node->nd_else;
+ break;
- case NODE_NEWLINE:
- return value_expr(node->nd_next);
+ case NODE_AND:
+ case NODE_OR:
+ node = node->nd_2nd;
+ break;
- default:
- return Qtrue;
+ case NODE_NEWLINE:
+ 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);
}
diff --git a/version.h b/version.h
index 2dd442843d..ec87324b7b 100644
--- a/version.h
+++ b/version.h
@@ -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