* misc/ruby-mode.el: better support for general delimited

strings.  [ruby-dev:22695]

* lib/weakref.rb (WeakRef::initialize): set up @__id before
  calling "super".

* lib/delegate.rb (Delegator::initialize): preserve
  singleton_method_added method [ruby-dev:22685]

* lib/delegate.rb (Delegator::initialize): use Kernel::raise
  instead of mere raise.  [ruby-dev:22681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-01-27 06:05:04 +00:00
Родитель 8df4564367
Коммит 51e6d9061d
9 изменённых файлов: 39 добавлений и 24 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Tue Jan 27 15:00:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* misc/ruby-mode.el: better support for general delimited
strings. [ruby-dev:22695]
Tue Jan 27 11:04:40 2004 FUKUMOTO Atsushi <fukumoto@nospam.imasy.or.jp> Tue Jan 27 11:04:40 2004 FUKUMOTO Atsushi <fukumoto@nospam.imasy.or.jp>
* ext/socket/socket.c (s_recvfrom): sending length should be an * ext/socket/socket.c (s_recvfrom): sending length should be an
@ -16,6 +21,17 @@ Mon Jan 26 22:53:04 2004 Dave Thomas <dave@pragprog.com>
* io.c: Remove documentation references to $defout. * io.c: Remove documentation references to $defout.
Mon Jan 26 14:41:46 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/weakref.rb (WeakRef::initialize): set up @__id before
calling "super".
* lib/delegate.rb (Delegator::initialize): preserve
singleton_method_added method [ruby-dev:22685]
* lib/delegate.rb (Delegator::initialize): use Kernel::raise
instead of mere raise. [ruby-dev:22681]
Mon Jan 26 12:45:23 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> Mon Jan 26 12:45:23 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: define CONST84 when TCL_MAJOR_VERSION == 7 * ext/tcltklib/tcltklib.c: define CONST84 when TCL_MAJOR_VERSION == 7

Просмотреть файл

@ -229,7 +229,7 @@ $(srcdir)/configure: $(srcdir)/configure.in
lex.c: keywords lex.c: keywords
@-rm -f $@ @-rm -f $@
gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $> > $@ || \ gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $< > $@ || \
cp "$(srcdir)/$@" . cp "$(srcdir)/$@" .
.y.c: .y.c:

Просмотреть файл

@ -21,7 +21,11 @@
#elif defined(HAVE_NCURSES_CURSES_H) #elif defined(HAVE_NCURSES_CURSES_H)
# include <ncurses/curses.h> # include <ncurses/curses.h>
#elif defined(HAVE_CURSES_COLR_CURSES_H) #elif defined(HAVE_CURSES_COLR_CURSES_H)
# include <varargs.h> # ifdef HAVE_STDARG_PROTOTYPES
# include <stdarg.h>
# else
# include <varargs.h>
# endif
# include <curses_colr/curses.h> # include <curses_colr/curses.h>
#else #else
# include <curses.h> # include <curses.h>

Просмотреть файл

@ -20,7 +20,7 @@ test(iconv_t cd, char **inptr, size_t *inlen, char **outptr, size_t *outlen)
else else
$defs.push('-DICONV_INPTR_CAST="(char **)"') $defs.push('-DICONV_INPTR_CAST="(char **)"')
end end
have_library("iconv") have_library("iconv", "iconv")
if conf if conf
prefix = '$(srcdir)' prefix = '$(srcdir)'
prefix = $nmake ? "{#{prefix}}" : "#{prefix}/" prefix = $nmake ? "{#{prefix}}" : "#{prefix}/"

Просмотреть файл

@ -27,6 +27,7 @@ class Delegator
preserved |= t.protected_instance_methods(false) preserved |= t.protected_instance_methods(false)
break if t == Delegator break if t == Delegator
end end
preserved << "singleton_method_added"
for method in obj.methods for method in obj.methods
next if preserved.include? method next if preserved.include? method
begin begin
@ -37,7 +38,7 @@ class Delegator
rescue Exception rescue Exception
$@.delete_if{|s| /:in `__getobj__'$/ =~ s} #` $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #`
$@.delete_if{|s| /^\\(eval\\):/ =~ s} $@.delete_if{|s| /^\\(eval\\):/ =~ s}
raise ::Kernel::raise
end end
end end
EOS EOS

Просмотреть файл

@ -1,6 +1,6 @@
module REXML module REXML
module Encoding module Encoding
@@__REXML_encoding_methods =<<-EOL @@__REXML_encoding_methods =<<-'EOL'
# Convert from UTF-8 # Convert from UTF-8
def encode content def encode content
array_utf8 = content.unpack('U*') array_utf8 = content.unpack('U*')

Просмотреть файл

@ -41,8 +41,7 @@ class WeakRef<Delegator
} }
def initialize(orig) def initialize(orig)
super @__id = orig.object_id
@__id = orig.__id__
ObjectSpace.define_finalizer orig, @@final ObjectSpace.define_finalizer orig, @@final
ObjectSpace.define_finalizer self, @@final ObjectSpace.define_finalizer self, @@final
__old_status = Thread.critical __old_status = Thread.critical
@ -52,23 +51,24 @@ class WeakRef<Delegator
ensure ensure
Thread.critical = __old_status Thread.critical = __old_status
end end
@@id_map[@__id].push self.__id__ @@id_map[@__id].push self.object_id
@@id_rev_map[self.__id__] = @__id @@id_rev_map[self.object_id] = @__id
super
end end
def __getobj__ def __getobj__
unless @@id_rev_map[self.__id__] == @__id unless @@id_rev_map[self.object_id] == @__id
raise RefError, "Illegal Reference - probably recycled", caller(2) Kernel::raise RefError, "Illegal Reference - probably recycled", Kernel::caller(2)
end end
begin begin
ObjectSpace._id2ref(@__id) ObjectSpace._id2ref(@__id)
rescue RangeError rescue RangeError
raise RefError, "Illegal Reference - probably recycled", caller(2) Kernel::raise RefError, "Illegal Reference - probably recycled", Kernel::caller(2)
end end
end end
def weakref_alive? def weakref_alive?
@@id_rev_map[self.__id__] == @__id @@id_rev_map[self.object_id] == @__id
end end
end end

Просмотреть файл

@ -1013,10 +1013,6 @@ balanced expression is found."
("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)" ("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
(4 (7 . ?/)) (4 (7 . ?/))
(6 (7 . ?/))) (6 (7 . ?/)))
;; %Q!...!
("\\(^\\|[[ \t\n<+(,=]\\)%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\2\\)"
(2 (7 . nil))
(4 (7 . nil)))
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil)) ("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil)))) ("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))))
@ -1098,7 +1094,6 @@ balanced expression is found."
t) t)
nil))) nil)))
(defvar ruby-font-lock-keywords (defvar ruby-font-lock-keywords
(list (list
;; functions ;; functions
@ -1168,6 +1163,9 @@ balanced expression is found."
0 font-lock-string-face t) 0 font-lock-string-face t)
`(,ruby-here-doc-beg-re `(,ruby-here-doc-beg-re
0 font-lock-string-face t) 0 font-lock-string-face t)
;; general delimited string
'("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)"
(2 font-lock-string-face))
;; constants ;; constants
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
2 font-lock-type-face) 2 font-lock-type-face)

8
ruby.h
Просмотреть файл

@ -638,9 +638,7 @@ rb_class_of(obj)
if (obj == Qnil) return rb_cNilClass; if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass; if (obj == Qfalse) return rb_cFalseClass;
} }
else{ return RBASIC(obj)->klass;
return RBASIC(obj)->klass;
}
} }
static inline int static inline int
@ -661,9 +659,7 @@ rb_type(obj)
if (obj == Qnil) return T_NIL; if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE; if (obj == Qfalse) return T_FALSE;
} }
else{ return BUILTIN_TYPE(obj);
return BUILTIN_TYPE(obj);
}
} }
static inline int static inline int