summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-01 07:34:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-01 07:34:58 +0000
commit9b0dd20cbb3d0077c374509eb230adba84ed5488 (patch)
tree2a7936d597eff812a4e3fa896de7439b884a75f8 /parse.y
parent2344efc3835c3226fa06a85e6f3b1871415b8ad1 (diff)
990201
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y22
1 files changed, 20 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 71ca654305..16410a9c1e 100644
--- a/parse.y
+++ b/parse.y
@@ -18,6 +18,8 @@
#include "node.h"
#include "st.h"
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
/* hack for bison */
#ifdef const
@@ -801,6 +803,10 @@ call_args : command_call
value_expr($1);
$$ = NEW_LIST($1);
}
+ | args ','
+ {
+ $$ = $1;
+ }
| args opt_block_arg
{
$$ = arg_blk_pass($1, $2);
@@ -810,6 +816,10 @@ call_args : command_call
$$ = arg_add($1, $4);
$$ = arg_blk_pass($$, $5);
}
+ | assocs ','
+ {
+ $$ = NEW_LIST(NEW_HASH($1));
+ }
| assocs opt_block_arg
{
$$ = NEW_LIST(NEW_HASH($1));
@@ -825,6 +835,10 @@ call_args : command_call
$$ = list_append($1, NEW_HASH($3));
$$ = arg_blk_pass($$, $4);
}
+ | args ',' assocs ','
+ {
+ $$ = list_append($1, NEW_HASH($3));
+ }
| args ',' assocs ',' tSTAR arg opt_block_arg
{
$$ = arg_add(list_append($1, NEW_HASH($3)), $6);
@@ -2844,7 +2858,11 @@ retry:
pushback(c);
tokfix();
if (is_float) {
- yylval.val = rb_float_new(atof(tok()));
+ double d = strtod(tok(), 0);
+ if (errno == ERANGE) {
+ yyerror("Float out of range");
+ }
+ yylval.val = rb_float_new(d);
return tFLOAT;
}
yylval.val = rb_str2inum(tok(), 10);
@@ -3427,7 +3445,7 @@ block_append(head, tail)
end = head->nd_end;
}
- if (RTEST(rb_verbose)) {
+ if (RTEST(ruby_verbose)) {
NODE *nd = end->nd_head;
newline:
switch (nd_type(nd)) {