diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-21 15:42:12 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-21 15:42:12 +0000 |
commit | f1fdbf080efdf954a4773baf2dd088eddb7c03ef (patch) | |
tree | 8a2e0db3367f57d457917a2637feec1dd657b6ad /parse.y | |
parent | e15f65b004eaa43a013f8d069479c55e70563177 (diff) | |
download | ruby-f1fdbf080efdf954a4773baf2dd088eddb7c03ef.tar.gz |
* parse.y (str_extend): should check nesting parentheses in #{}.
* process.c (pst_wstopsig): returns nil unless WIFSTOPPED() is
non-zero.
* process.c (pst_wtermsig): returns nil unless WIFSIGNALED() is
non-zero.
* process.c (pst_wexitstatus): returns nil unless WIFEXITED() is
non-zero.
* eval.c (rb_thread_select): tv_sec and tv_usec should not be
negative.
* signal.c (posix_signal): do not set SA_RESTART for SIGVTALRM.
* parse.y (call_args2): block_arg may follow the first argument in
call_args2.
* eval.c (stack_check): should avoid stack length check during
raising SystemStackError exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -1104,6 +1104,10 @@ call_args2 : arg ',' args opt_block_arg { $$ = arg_blk_pass(list_concat(NEW_LIST($1),$3), $4); } + | arg ',' block_arg + { + $$ = arg_blk_pass($1, $3); + } | arg ',' tSTAR arg opt_block_arg { value_expr($1); @@ -2044,7 +2048,7 @@ none : /* none */ static char *tokenbuf = NULL; static int tokidx, toksiz = 0; -static NODE *str_extend(); +static NODE *str_extend _((NODE*,char,char)); #define LEAVE_BS 1 @@ -2513,7 +2517,7 @@ parse_regx(term, paren) switch (c) { case '#': - list = str_extend(list, term); + list = str_extend(list, term, paren); if (list == (NODE*)-1) goto unterminated; continue; @@ -2642,7 +2646,7 @@ parse_string(func, term, paren) } } else if (c == '#') { - list = str_extend(list, term); + list = str_extend(list, term, paren); if (list == (NODE*)-1) goto unterm_str; continue; } @@ -3873,15 +3877,16 @@ yylex() } static NODE* -str_extend(list, term) +str_extend(list, term, paren) NODE *list; - char term; + char term, paren; { int c; int brace = -1; VALUE ss; NODE *node; - int nest; + int brace_nest = 0; + int paren_nest = 0; c = nextc(); switch (c) { @@ -3996,13 +4001,13 @@ str_extend(list, term) case '{': if (c == '{') brace = '}'; - nest = 0; + brace_nest = 0; do { loop_again: c = nextc(); switch (c) { case -1: - if (nest > 0) { + if (brace_nest > 0) { yyerror("bad substitution in string"); newtok(); return list; @@ -4010,8 +4015,8 @@ str_extend(list, term) return (NODE*)-1; case '}': if (c == brace) { - if (nest == 0) break; - nest--; + if (brace_nest == 0) break; + brace_nest--; } tokadd(c); goto loop_again; @@ -4027,9 +4032,10 @@ str_extend(list, term) } break; case '{': - if (brace != -1) nest++; + if (brace != -1) brace_nest++; default: - if (c == term) { + if (c == paren) paren_nest++; + else if (c == term && (!paren || paren_nest-- == 0)) { pushback(c); list_append(list, NEW_STR(rb_str_new2("#"))); rb_warn("bad substitution in string"); @@ -4282,7 +4288,7 @@ gettable(id) if (in_single) return NEW_CVAR2(id); return NEW_CVAR(id); } - rb_bug("invalid id for gettable"); + rb_compile_error("identifier %s is not valid", rb_id2name(id)); return 0; } |