summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y28
1 files changed, 25 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index a4142bbe20..16410a9c1e 100644
--- a/parse.y
+++ b/parse.y
@@ -6,7 +6,7 @@
$Date$
created at: Fri May 28 18:02:42 JST 1993
- Copyright (C) 1993-1998 Yukihiro Matsumoto
+ Copyright (C) 1993-1999 Yukihiro Matsumoto
************************************************/
@@ -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);
@@ -1745,6 +1759,10 @@ normalize_newline(line)
RSTRING(line)->ptr[RSTRING(line)->len-2] = '\n';
RSTRING(line)->len--;
}
+#ifdef __MACOS__
+ else if (RSTRING(line)->ptr[RSTRING(line)->len-1] == '\r')
+ RSTRING(line)->ptr[RSTRING(line)->len-1] = '\n';
+#endif
}
static int
@@ -2840,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);
@@ -3423,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)) {