summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
commita1c02ee495d945f943fedc3f11fcb323289dc756 (patch)
tree258fdf9c591ffa5bab8d8be49302198241eb4fa7 /parse.y
parente60d5563210cccef2e9da17970ab3ea1906a8185 (diff)
* math.c (math_acos): check errno after operation. ditto for
asin, acosh, atanh, log, log10 and sqrt. * eval.c (rb_add_method): initialize should always be private. * parse.y (expr): add rescue modifier rule. * parse.y (command_call): return, break and next with argument is now part of this rule. * parse.y (yylex): "a" in "a /5" should be considered as a local variable. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y40
1 files changed, 21 insertions, 19 deletions
diff --git a/parse.y b/parse.y
index c433509..5b8417f 100644
--- a/parse.y
+++ b/parse.y
@@ -555,19 +555,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
| expr
;
-expr : kRETURN call_args
- {
- $$ = NEW_RETURN(ret_args($2));
- }
- | kBREAK call_args
- {
- $$ = NEW_BREAK(ret_args($2));
- }
- | kNEXT call_args
- {
- $$ = NEW_NEXT(ret_args($2));
- }
- | command_call
+expr : command_call
| expr kAND expr
{
$$ = logop(NODE_AND, $1, $3);
@@ -584,6 +572,7 @@ expr : kRETURN call_args
{
$$ = NEW_NOT(cond($2));
}
+ | arg kRESCUE_MOD command_call
| arg
;
@@ -596,6 +585,18 @@ expr_value : expr
command_call : command
| block_command
+ | kRETURN call_args
+ {
+ $$ = NEW_RETURN(ret_args($2));
+ }
+ | kBREAK call_args
+ {
+ $$ = NEW_BREAK(ret_args($2));
+ }
+ | kNEXT call_args
+ {
+ $$ = NEW_NEXT(ret_args($2));
+ }
;
block_command : block_call
@@ -3129,10 +3130,6 @@ arg_ambiguous()
rb_warning("ambiguous first argument; make sure");
}
-#if !defined(strtod) && !defined(HAVE_STDLIB_H)
-double strtod ();
-#endif
-
#define IS_ARG() (lex_state == EXPR_ARG || lex_state == EXPR_CMDARG)
static int
@@ -4251,10 +4248,12 @@ yylex()
lex_state == EXPR_DOT ||
lex_state == EXPR_ARG ||
lex_state == EXPR_CMDARG) {
- if (cmd_state)
+ if (cmd_state) {
lex_state = EXPR_CMDARG;
- else
+ }
+ else {
lex_state = EXPR_ARG;
+ }
}
else {
lex_state = EXPR_END;
@@ -4269,6 +4268,9 @@ yylex()
return -1;
}
last_id = yylval.id = rb_intern(tok());
+ if ((dyna_in_block() && rb_dvar_defined(last_id)) || local_id(last_id)) {
+ lex_state = EXPR_END;
+ }
return result;
}
}