1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (parse_quotedwords): %w should allow parenthesis escape.

* parse.y (parse_qstring): %q should allow terminator escape.

* re.c (rb_reg_equal): all option flags should be same to be equal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2001-02-08 09:18:04 +00:00
parent ab65e3df29
commit 10f884d85a
17 changed files with 71 additions and 87 deletions

View file

@ -1,9 +1,37 @@
Wed Feb 7 16:05:22 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* parse.y (parse_quotedwords): %w should allow parenthesis escape.
Wed Feb 7 00:57:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (parse_qstring): %q should allow terminator escape.
Wed Feb 7 00:57:42 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (rb_reg_equal): all option flags should be same to be equal.
Tue Feb 6 21:01:29 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp> Tue Feb 6 21:01:29 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb: ignore EOFError on only specified case. * lib/net/protocol.rb: ignore EOFError on only specified case.
* lib/net/http.rb: take HTTP 1.0 server into account. * lib/net/http.rb: take HTTP 1.0 server into account.
Mon Feb 5 00:39:06 2001 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
* dir.c: use ISXXX() instead of isxxx().
* dln.c (aix_loaderror): ditto.
* file.c (rb_file_s_expand_path): ditto.
* string.c (rb_str_upcase_bang): ditto.
* win32/win32.c (do_spawn): ditto.
* win32/win32.c (NtMakeCmdVector): ditto.
* win32/win32.c (opendir): ditto.
Fri Feb 3 00:48:50 2001 Usaku Nakamura <usa@osb.att.ne.jp> Fri Feb 3 00:48:50 2001 Usaku Nakamura <usa@osb.att.ne.jp>
* win32/win32.c (isInternalCmd): ignore case for shell's internal * win32/win32.c (isInternalCmd): ignore case for shell's internal
@ -11,9 +39,6 @@ Fri Feb 3 00:48:50 2001 Usaku Nakamura <usa@osb.att.ne.jp>
Fri Feb 2 16:14:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Feb 2 16:14:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_sort_bang): returns self, even if its length is
less than 2.
* eval.c (POP_VARS): propagate DVAR_DONT_RECYCLE, if * eval.c (POP_VARS): propagate DVAR_DONT_RECYCLE, if
SCOPE_DONT_RECYCLE of ruby_scope is set. SCOPE_DONT_RECYCLE of ruby_scope is set.

View file

@ -319,6 +319,7 @@ main()
], rb_cv_func_strtod=yes, rb_cv_func_strtod=no, rb_cv_func_strtod=no)]) ], rb_cv_func_strtod=yes, rb_cv_func_strtod=no, rb_cv_func_strtod=no)])
test $rb_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o" test $rb_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
AC_C_INLINE
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_C_CONST AC_C_CONST
AC_C_CHAR_UNSIGNED AC_C_CHAR_UNSIGNED

2
dir.c
View file

@ -69,7 +69,7 @@ char *strchr _((char*,char));
#define FNM_NOMATCH 1 #define FNM_NOMATCH 1
#define FNM_ERROR 2 #define FNM_ERROR 2
#define downcase(c) (nocase && isupper(c) ? tolower(c) : (c)) #define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c))
#if defined DOSISH #if defined DOSISH
#define isdirsep(c) ((c) == '/' || (c) == '\\') #define isdirsep(c) ((c) == '/' || (c) == '\\')

2
dln.c
View file

@ -1204,7 +1204,7 @@ aix_loaderror(const char *pathname)
if (nerr == load_errtab[i].errno && load_errtab[i].errstr) if (nerr == load_errtab[i].errno && load_errtab[i].errstr)
ERRBUF_APPEND(load_errtab[i].errstr); ERRBUF_APPEND(load_errtab[i].errstr);
} }
while (isdigit(*message[i])) message[i]++; while (ISDIGIT(*message[i])) message[i]++;
ERRBUF_APPEND(message[i]); ERRBUF_APPEND(message[i]);
ERRBUF_APPEND("\n"); ERRBUF_APPEND("\n");
} }

2
eval.c
View file

@ -4471,7 +4471,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
struct cache_entry *ent; struct cache_entry *ent;
if (!klass) { if (!klass) {
rb_raise(rb_eNotImpError, "method call on terminated obejct"); rb_raise(rb_eNotImpError, "method call on terminated object");
} }
/* is it in the method cache? */ /* is it in the method cache? */
ent = cache + EXPR1(klass, mid); ent = cache + EXPR1(klass, mid);

2
file.c
View file

@ -1253,7 +1253,7 @@ rb_file_s_expand_path(argc, argv)
} }
#if defined DOSISH #if defined DOSISH
/* skip drive letter */ /* skip drive letter */
else if (isalpha(s[0]) && s[1] == ':' && isdirsep(s[2])) { else if (ISALPHA(s[0]) && s[1] == ':' && isdirsep(s[2])) {
while (*s && !isdirsep(*s)) { while (*s && !isdirsep(*s)) {
*p++ = *s++; *p++ = *s++;
} }

9
gc.c
View file

@ -315,10 +315,7 @@ rb_data_object_alloc(klass, datap, dmark, dfree)
extern st_table *rb_class_tbl; extern st_table *rb_class_tbl;
VALUE *rb_gc_stack_start = 0; VALUE *rb_gc_stack_start = 0;
#if defined(__GNUC__) && __GNUC__ >= 2 static inline int
__inline__
#endif
static int
is_pointer_to_heap(ptr) is_pointer_to_heap(ptr)
void *ptr; void *ptr;
{ {
@ -1053,6 +1050,7 @@ os_live_obj()
case T_CLASS: case T_CLASS:
if (FL_TEST(p, FL_SINGLETON)) continue; if (FL_TEST(p, FL_SINGLETON)) continue;
default: default:
if (!p->as.basic.klass) continue;
rb_yield((VALUE)p); rb_yield((VALUE)p);
n++; n++;
} }
@ -1085,6 +1083,7 @@ os_obj_of(of)
case T_CLASS: case T_CLASS:
if (FL_TEST(p, FL_SINGLETON)) continue; if (FL_TEST(p, FL_SINGLETON)) continue;
default: default:
if (!p->as.basic.klass) continue;
if (rb_obj_is_kind_of((VALUE)p, of)) { if (rb_obj_is_kind_of((VALUE)p, of)) {
rb_yield((VALUE)p); rb_yield((VALUE)p);
n++; n++;
@ -1218,7 +1217,6 @@ run_final(obj)
} }
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) { if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) { for (i=0; i<RARRAY(table)->len; i++) {
printf("n finals=>%d\n", finalizer_table->num_entries);
args[0] = RARRAY(table)->ptr[i]; args[0] = RARRAY(table)->ptr[i];
rb_protect(run_single_final, (VALUE)args, &status); rb_protect(run_single_final, (VALUE)args, &status);
} }
@ -1247,7 +1245,6 @@ rb_gc_call_finalizer_at_exit()
if (FL_TEST(p, FL_FINALIZE)) { if (FL_TEST(p, FL_FINALIZE)) {
FL_UNSET(p, FL_FINALIZE); FL_UNSET(p, FL_FINALIZE);
p->as.basic.klass = 0; p->as.basic.klass = 0;
printf("%p\n", p);
run_final((VALUE)p); run_final((VALUE)p);
} }
p++; p++;

View file

@ -9,11 +9,12 @@
for k,v in ENV for k,v in ENV
next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k
v = v.gsub(/\\/) {|s| '\\'+s}
eval <<EOS eval <<EOS
$#{k} = %q!#{v}! $#{k} = %q\0#{v}\0
trace_var "$#{k}", proc{|v| trace_var "$#{k}", proc{|v|
ENV[%q!#{k}!] = v; ENV[%q!#{k}!] = v
$#{k} = %q!#{v}! $#{k} = v
if v == nil if v == nil
untrace_var "$#{k}" untrace_var "$#{k}"
end end

View file

@ -5,7 +5,7 @@
module Observable module Observable
def add_observer(observer) def add_observer(observer)
@observer_peers = [] unless defined? @observer_peers @observer_peers = [] unless defined? @observer_peers
unless defined? observer.update unless observer.respond_to? :update
raise NameError, "observer needs to respond to `update'" raise NameError, "observer needs to respond to `update'"
end end
@observer_peers.push observer @observer_peers.push observer

View file

@ -749,7 +749,7 @@ An end of a defun is found by moving forward from the beginning of one."
'("^\\s *def\\s +\\([^( ]+\\)" '("^\\s *def\\s +\\([^( ]+\\)"
1 font-lock-function-name-face) 1 font-lock-function-name-face)
;; symbols ;; symbols
'("\\(^\\|[^:]\\)\\(:\\(\\w\\|_\\)+\\??\\)\\b" '("\\(^\\|[^:]\\)\\(:\\([-+/%&|^~`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|\\[\\]\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b\\)\\)\\)"
2 font-lock-reference-face)) 2 font-lock-reference-face))
"*Additional expressions to highlight in ruby mode.")) "*Additional expressions to highlight in ruby mode."))

6
pack.c
View file

@ -1026,11 +1026,7 @@ qpencode(str, from, len)
} }
} }
#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(RUBY_NO_INLINE) static inline int
static __inline__ int
#else
static int
#endif
hex2num(c) hex2num(c)
char c; char c;
{ {

13
parse.y
View file

@ -2547,13 +2547,12 @@ parse_qstring(term, paren)
c = '\\'; c = '\\';
break; break;
case '\'':
if (term == '\'') {
c = '\'';
break;
}
/* fall through */
default: default:
/* fall through */
if (c == term || (paren && c == paren)) {
tokadd(c);
continue;
}
tokadd('\\'); tokadd('\\');
} }
} }
@ -2608,7 +2607,7 @@ parse_quotedwords(term, paren)
c = '\\'; c = '\\';
break; break;
default: default:
if (c == term) { if (c == term || (paren && c == paren)) {
tokadd(c); tokadd(c);
continue; continue;
} }

3
re.c
View file

@ -915,8 +915,7 @@ rb_reg_equal(re1, re2)
if (min > RREGEXP(re2)->len) min = RREGEXP(re2)->len; if (min > RREGEXP(re2)->len) min = RREGEXP(re2)->len;
if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, min) == 0 && if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, min) == 0 &&
rb_reg_cur_kcode(re1) == rb_reg_cur_kcode(re2) && rb_reg_cur_kcode(re1) == rb_reg_cur_kcode(re2) &&
!((RREGEXP(re1)->ptr->options & RE_OPTION_IGNORECASE) ^ RREGEXP(re1)->ptr->options == RREGEXP(re2)->ptr->options) {
(RREGEXP(re2)->ptr->options & RE_OPTION_IGNORECASE))) {
return Qtrue; return Qtrue;
} }
return Qfalse; return Qfalse;

28
ruby.h
View file

@ -542,12 +542,14 @@ EXTERN VALUE rb_eNameError;
EXTERN VALUE rb_eSyntaxError; EXTERN VALUE rb_eSyntaxError;
EXTERN VALUE rb_eLoadError; EXTERN VALUE rb_eLoadError;
#if defined(__GNUC__) && __GNUC__ >= 2 && !defined(RUBY_NO_INLINE) extern inline VALUE rb_class_of _((VALUE));
extern __inline__ VALUE rb_class_of _((VALUE)); extern inline int rb_type _((VALUE));
extern __inline__ int rb_type _((VALUE)); extern inline int rb_special_const_p _((VALUE));
extern __inline__ int rb_special_const_p _((VALUE));
extern __inline__ VALUE #ifndef RUBY_NO_INLINE
extern inline
#endif
VALUE
rb_class_of(VALUE obj) rb_class_of(VALUE obj)
{ {
if (FIXNUM_P(obj)) return rb_cFixnum; if (FIXNUM_P(obj)) return rb_cFixnum;
@ -559,7 +561,10 @@ rb_class_of(VALUE obj)
return RBASIC(obj)->klass; return RBASIC(obj)->klass;
} }
extern __inline__ int #ifndef RUBY_NO_INLINE
extern inline
#endif
int
rb_type(VALUE obj) rb_type(VALUE obj)
{ {
if (FIXNUM_P(obj)) return T_FIXNUM; if (FIXNUM_P(obj)) return T_FIXNUM;
@ -571,19 +576,16 @@ rb_type(VALUE obj)
return BUILTIN_TYPE(obj); return BUILTIN_TYPE(obj);
} }
extern __inline__ int #ifndef RUBY_NO_INLINE
extern inline
#endif
int
rb_special_const_p(VALUE obj) rb_special_const_p(VALUE obj)
{ {
if (SPECIAL_CONST_P(obj)) return Qtrue; if (SPECIAL_CONST_P(obj)) return Qtrue;
return Qfalse; return Qfalse;
} }
#else
VALUE rb_class_of _((VALUE));
int rb_type _((VALUE));
int rb_special_const_p _((VALUE));
#endif
#include "intern.h" #include "intern.h"
#if defined(EXTLIB) && defined(USE_DLN_A_OUT) #if defined(EXTLIB) && defined(USE_DLN_A_OUT)

View file

@ -1652,7 +1652,7 @@ rb_str_upcase_bang(str)
if (ismbchar(*s)) { if (ismbchar(*s)) {
s+=mbclen(*s) - 1; s+=mbclen(*s) - 1;
} }
else if (islower(*s)) { else if (ISLOWER(*s)) {
*s = toupper(*s); *s = toupper(*s);
modify = 1; modify = 1;
} }

36
util.c
View file

@ -19,42 +19,6 @@
#define RUBY_NO_INLINE #define RUBY_NO_INLINE
#include "ruby.h" #include "ruby.h"
VALUE
rb_class_of(obj)
VALUE obj;
{
if (FIXNUM_P(obj)) return rb_cFixnum;
if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass;
if (obj == Qtrue) return rb_cTrueClass;
if (SYMBOL_P(obj)) return rb_cSymbol;
return RBASIC(obj)->klass;
}
int
rb_type(obj)
VALUE obj;
{
if (FIXNUM_P(obj)) return T_FIXNUM;
if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
if (obj == Qtrue) return T_TRUE;
if (obj == Qundef) return T_UNDEF;
if (SYMBOL_P(obj)) return T_SYMBOL;
return BUILTIN_TYPE(obj);
}
int
rb_special_const_p(obj)
VALUE obj;
{
if (SPECIAL_CONST_P(obj)) return Qtrue;
return Qfalse;
}
#include "util.h" #include "util.h"
#ifndef HAVE_STRING_H #ifndef HAVE_STRING_H
char *strchr _((char*,char)); char *strchr _((char*,char));

View file

@ -777,10 +777,10 @@ char *cmd;
strcpy(cmd2, cmd); strcpy(cmd2, cmd);
a = argv; a = argv;
for (s = cmd2; *s;) { for (s = cmd2; *s;) {
while (*s && isspace(*s)) s++; while (*s && ISSPACE(*s)) s++;
if (*s) if (*s)
*(a++) = s; *(a++) = s;
while (*s && !isspace(*s)) s++; while (*s && !ISSPACE(*s)) s++;
if (*s) if (*s)
*s++ = '\0'; *s++ = '\0';
} }
@ -1054,7 +1054,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
// //
ptr = cmdline+(cmdlen - 1); ptr = cmdline+(cmdlen - 1);
while(ptr >= cmdline && isspace(*ptr)) while(ptr >= cmdline && ISSPACE(*ptr))
--ptr; --ptr;
*++ptr = '\0'; *++ptr = '\0';
@ -1074,7 +1074,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
// zap any leading whitespace // zap any leading whitespace
// //
while(isspace(*ptr)) while(ISSPACE(*ptr))
ptr++; ptr++;
base = ptr; base = ptr;
@ -1311,7 +1311,7 @@ opendir(char *filename)
if ((stat (filename, &sbuf) < 0 || if ((stat (filename, &sbuf) < 0 ||
sbuf.st_mode & _S_IFDIR == 0) && sbuf.st_mode & _S_IFDIR == 0) &&
(!isalpha(filename[0]) || filename[1] != ':' || filename[2] != '\0' || (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) {
return NULL; return NULL;
} }