summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--configure84
-rw-r--r--configure.in4
-rw-r--r--parse.y26
-rw-r--r--sample/test.rb27
-rw-r--r--win32/config.h1
6 files changed, 86 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index 98c706bdac..747320febd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jun 20 02:53:50 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (assignable): nesting local variables should have higher
+ priority than normal local variables for assignment too.
+
Fri Jun 19 18:28:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_27.
diff --git a/configure b/configure
index aca499b3db..5be0784a8b 100644
--- a/configure
+++ b/configure
@@ -3182,11 +3182,13 @@ else
int
main()
{
- return (-1!=(((-1)<<1)&FIXNUM_FLAG)>>1);
+ if (-1==(((-1)<<1)|FIXNUM_FLAG)>>1);
+ return 0;
+ return 1;
}
EOF
-if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_rshift_sign=yes
else
@@ -3214,19 +3216,19 @@ EOF
fi
echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6
-echo "configure:3218: checking count field in FILE structures" >&5
+echo "configure:3220: checking count field in FILE structures" >&5
if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3223 "configure"
+#line 3225 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->_cnt = 0;
; return 0; }
EOF
-if { (eval echo configure:3230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="_cnt"
else
@@ -3236,14 +3238,14 @@ fi
rm -f conftest*
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3240 "configure"
+#line 3242 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->__cnt = 0;
; return 0; }
EOF
-if { (eval echo configure:3247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="__cnt"
else
@@ -3254,14 +3256,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3258 "configure"
+#line 3260 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->_r = 0;
; return 0; }
EOF
-if { (eval echo configure:3265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="_r"
else
@@ -3272,14 +3274,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3276 "configure"
+#line 3278 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->readCount = 0;
; return 0; }
EOF
-if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="readCount"
else
@@ -3304,9 +3306,9 @@ fi
if test "$ac_cv_func_getpwent" = yes; then
echo $ac_n "checking struct passwd""... $ac_c" 1>&6
-echo "configure:3308: checking struct passwd" >&5
+echo "configure:3310: checking struct passwd" >&5
cat > conftest.$ac_ext <<EOF
-#line 3310 "configure"
+#line 3312 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3321,7 +3323,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3325 "configure"
+#line 3327 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3336,7 +3338,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3340 "configure"
+#line 3342 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3351,7 +3353,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3355 "configure"
+#line 3357 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3366,7 +3368,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3370 "configure"
+#line 3372 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3381,7 +3383,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3385 "configure"
+#line 3387 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3396,7 +3398,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3400 "configure"
+#line 3402 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3429,7 +3431,7 @@ fi
case "$host_os" in
linux*)
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
-echo "configure:3433: checking whether ELF binaries are produced" >&5
+echo "configure:3435: checking whether ELF binaries are produced" >&5
if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3437,7 +3439,7 @@ else
:
else
cat > conftest.$ac_ext <<EOF
-#line 3441 "configure"
+#line 3443 "configure"
#include "confdefs.h"
/* Test for whether ELF binaries are produced */
@@ -3457,7 +3459,7 @@ main() {
}
EOF
-if { (eval echo configure:3461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_linux_elf=yes
else
@@ -3487,7 +3489,7 @@ STATIC=
if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6
-echo "configure:3491: checking whether OS depend dynamic link works" >&5
+echo "configure:3493: checking whether OS depend dynamic link works" >&5
if test "$GCC" = yes; then
case "$host_os" in
nextstep*) ;;
@@ -3565,13 +3567,13 @@ dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6
-echo "configure:3569: checking whether matz's dln works" >&5
+echo "configure:3571: checking whether matz's dln works" >&5
cat confdefs.h > config.h
if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3575 "configure"
+#line 3577 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@@ -3581,7 +3583,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_dln_a_out=yes
else
@@ -3678,7 +3680,7 @@ fi
case "$host_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
-echo "configure:3682: checking for _harderr in -lsignal" >&5
+echo "configure:3684: checking for _harderr in -lsignal" >&5
ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3686,7 +3688,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3690 "configure"
+#line 3692 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3697,7 +3699,7 @@ int main() {
_harderr()
; return 0; }
EOF
-if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3725,7 +3727,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
-echo "configure:3729: checking for hmemset in -lhmem" >&5
+echo "configure:3731: checking for hmemset in -lhmem" >&5
ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3733,7 +3735,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3737 "configure"
+#line 3739 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3744,7 +3746,7 @@ int main() {
hmemset()
; return 0; }
EOF
-if { (eval echo configure:3748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3774,12 +3776,12 @@ fi
for ac_func in select
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3778: checking for $ac_func" >&5
+echo "configure:3780: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3783 "configure"
+#line 3785 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3802,7 +3804,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3827,7 +3829,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
-echo "configure:3831: checking whether PD libc _dtos18 fail to convert big number" >&5
+echo "configure:3833: checking whether PD libc _dtos18 fail to convert big number" >&5
if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3835,7 +3837,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3839 "configure"
+#line 3841 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3847,7 +3849,7 @@ main ()
}
EOF
-if { (eval echo configure:3851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_missing__dtos18=yes
else
@@ -3869,7 +3871,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
-echo "configure:3873: checking whether PD libc fconvert fail to round" >&5
+echo "configure:3875: checking whether PD libc fconvert fail to round" >&5
if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3877,7 +3879,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3881 "configure"
+#line 3883 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3890,7 +3892,7 @@ main ()
}
EOF
-if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_missing_fconvert=yes
else
diff --git a/configure.in b/configure.in
index 40e082fa42..2c7a14bd7e 100644
--- a/configure.in
+++ b/configure.in
@@ -238,7 +238,9 @@ AC_CACHE_VAL(rb_cv_rshift_sign,
int
main()
{
- return (-1!=(((-1)<<1)&FIXNUM_FLAG)>>1);
+ if (-1==(((-1)<<1)|FIXNUM_FLAG)>>1);
+ return 0;
+ return 1;
}
],
rb_cv_rshift_sign=yes,
diff --git a/parse.y b/parse.y
index 50c8e389d4..8b1376659e 100644
--- a/parse.y
+++ b/parse.y
@@ -2155,7 +2155,7 @@ here_document(term)
c = term;
term = '"';
if (!is_identchar(c)) {
- yyerror("illegal here document");
+ Error("illegal here document");
return 0;
}
while (is_identchar(c)) {
@@ -3436,17 +3436,15 @@ assignable(id, val)
yyerror("Can't assign to __LINE__");
}
else if (is_local_id(id)) {
- if (local_id(id) || !dyna_in_block()) {
+ if (dyna_var_defined(id)) {
+ lhs = NEW_DASGN(id, val);
+ }
+ else if (local_id(id) || !dyna_in_block()) {
lhs = NEW_LASGN(id, val);
}
else{
- if (!dyna_var_defined(id)) {
- dyna_var_push(id, 0);
- lhs = NEW_DASGN_PUSH(id, val);
- }
- else {
- lhs = NEW_DASGN(id, val);
- }
+ dyna_var_push(id, 0);
+ lhs = NEW_DASGN_PUSH(id, val);
}
}
else if (is_global_id(id)) {
@@ -3520,10 +3518,10 @@ backref_error(node)
{
switch (nd_type(node)) {
case NODE_NTH_REF:
- Error("Can't set variable $%d", node->nd_nth);
+ yyerror("Can't set variable $%d", node->nd_nth);
break;
case NODE_BACK_REF:
- Error("Can't set variable $%c", node->nd_nth);
+ yyerror("Can't set variable $%c", node->nd_nth);
break;
}
}
@@ -3575,7 +3573,7 @@ assign_in_cond(node)
{
switch (nd_type(node)) {
case NODE_MASGN:
- Error("multiple assignment in conditional");
+ yyerror("multiple assignment in conditional");
return 1;
case NODE_LASGN:
@@ -4015,7 +4013,9 @@ rb_intern(name)
break;
}
}
- if (id == 0) NameError("Unknown operator `%s'", name);
+ if (id == 0) {
+ NameError("Unknown operator `%s'", name);
+ }
break;
}
diff --git a/sample/test.rb b/sample/test.rb
index d8926c6c29..3bc00306f6 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -739,14 +739,14 @@ end
ok(!$bad)
x = proc{}
-eval "i = 1", x
-ok(eval("i", x) == 1)
+eval "i4 = 1", x
+ok(eval("i4", x) == 1)
x = proc{proc{}}.call
-eval "i = 22", x
-ok(eval("i", x) == 22)
+eval "i4 = 22", x
+ok(eval("i4", x) == 22)
$x = []
x = proc{proc{}}.call
-eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
+eval "(0..9).each{|i5| $x[i5] = proc{i5*2}}", x
ok($x[4].call == 8)
x = binding
@@ -757,7 +757,7 @@ eval "i = 22", x
ok(eval("i", x) == 22)
$x = []
x = proc{binding}.call
-eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
+eval "(0..9).each{|i5| $x[i5] = proc{i5*2}}", x
ok($x[4].call == 8)
proc {
@@ -768,6 +768,21 @@ proc {
ok(eval("foo11") == 1)
}.call
+p1 = proc{i6 = 0; proc{i6}}.call
+ok(p1.call == 0)
+eval "i6=5", p1
+ok(p1.call == 5)
+ok(!defined?(i6))
+
+p1 = proc{i6 = 0; proc{i6}}.call
+i6 = nil
+ok(p1.call == 0)
+eval "i6=1", p1
+ok(p1.call == 1)
+eval "i6=5", p1
+ok(p1.call == 5)
+ok(i6 == nil)
+
check "system"
ok(`echo foobar` == "foobar\n")
ok(`./ruby -e 'print "foobar"'` == 'foobar')
diff --git a/win32/config.h b/win32/config.h
index 8c7b990d8d..de34e995d6 100644
--- a/win32/config.h
+++ b/win32/config.h
@@ -37,6 +37,7 @@
/* #define HAVE_SETITIMER 1 */
#define HAVE_GETGROUPS 1
/* #define HAVE_SIGPROCMASK 1 */
+#define RSHIFT(x,y) ((x)>>y)
#define FILE_COUNT _cnt
#define DLEXT ".dll"
#define RUBY_LIB ";/usr/local/lib/ruby;."