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

* lib/getoptlong.rb (GetoptLong#set_options): recieve arguments

as Array.

* lib/irb/slex.rb: use Proc#yield.

* lib/rdoc/markup/simple_markup/inline.rb: follow the new behavior
  of String#[].

* lib/rdoc/ri/ri_write.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2006-06-10 01:20:24 +00:00
parent 3e5f70a815
commit 8686ee1861
5 changed files with 32 additions and 25 deletions

View file

@ -1,4 +1,16 @@
Sat Jun %-2d 08:17:23 2006 U-HUDIE\nobu,S-1-5-21-3746871489-166115513-3294629105-1005 <nobu@ruby-lang.org> Sat Jun 10 10:13:13 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/getoptlong.rb (GetoptLong#set_options): recieve arguments
as Array.
* lib/irb/slex.rb: use Proc#yield.
* lib/rdoc/markup/simple_markup/inline.rb: follow the new behavior
of String#[].
* lib/rdoc/ri/ri_write.rb: ditto.
Sat Jun 10 08:17:23 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* math.c (log2): may be a macro. * math.c (log2): may be a macro.

View file

@ -289,14 +289,7 @@ class GetoptLong
@canonical_names.clear @canonical_names.clear
@argument_flags.clear @argument_flags.clear
arguments.each do |arg| arguments.each do |*arg|
#
# Each argument must be an Array.
#
if !arg.is_a?(Array)
raise ArgumentError, "the option list contains non-Array argument"
end
# #
# Find an argument flag and it set to `argument_flag'. # Find an argument flag and it set to `argument_flag'.
# #

View file

@ -167,9 +167,9 @@ module IRB
def match(chrs, op = "") def match(chrs, op = "")
D_DETAIL.print "match>: ", chrs, "op:", op, "\n" D_DETAIL.print "match>: ", chrs, "op:", op, "\n"
if chrs.empty? if chrs.empty?
if @preproc.nil? || @preproc.call(op, chrs) if @preproc.nil? || @preproc.yield(op, chrs)
DOUT.printf(D_DETAIL, "op1: %s\n", op) DOUT.printf(D_DETAIL, "op1: %s\n", op)
@postproc.call(op, chrs) @postproc.yield(op, chrs)
else else
nil nil
end end
@ -180,9 +180,9 @@ module IRB
return ret return ret
else else
chrs.unshift ch chrs.unshift ch
if @postproc and @preproc.nil? || @preproc.call(op, chrs) if @postproc and @preproc.nil? || @preproc.yield(op, chrs)
DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect) DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect)
ret = @postproc.call(op, chrs) ret = @postproc.yield(op, chrs)
return ret return ret
else else
return nil return nil
@ -190,9 +190,9 @@ module IRB
end end
else else
chrs.unshift ch chrs.unshift ch
if @postproc and @preproc.nil? || @preproc.call(op, chrs) if @postproc and @preproc.nil? || @preproc.yield(op, chrs)
DOUT.printf(D_DETAIL, "op3: %s\n", op) DOUT.printf(D_DETAIL, "op3: %s\n", op)
@postproc.call(op, chrs) @postproc.yield(op, chrs)
return "" return ""
else else
return nil return nil
@ -211,9 +211,9 @@ module IRB
ch = io.getc_of_rests ch = io.getc_of_rests
end end
if ch.nil? if ch.nil?
if @preproc.nil? || @preproc.call(op, io) if @preproc.nil? || @preproc.yield(op, io)
D_DETAIL.printf("op1: %s\n", op) D_DETAIL.printf("op1: %s\n", op)
@postproc.call(op, io) @postproc.yield(op, io)
else else
nil nil
end end
@ -223,18 +223,18 @@ module IRB
ret ret
else else
io.ungetc ch io.ungetc ch
if @postproc and @preproc.nil? || @preproc.call(op, io) if @postproc and @preproc.nil? || @preproc.yield(op, io)
DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect} DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect}
@postproc.call(op, io) @postproc.yield(op, io)
else else
nil nil
end end
end end
else else
io.ungetc ch io.ungetc ch
if @postproc and @preproc.nil? || @preproc.call(op, io) if @postproc and @preproc.nil? || @preproc.yield(op, io)
D_DETAIL.printf("op3: %s\n", op) D_DETAIL.printf("op3: %s\n", op)
@postproc.call(op, io) @postproc.yield(op, io)
else else
nil nil
end end

View file

@ -183,7 +183,7 @@ module SM
unless SPECIAL.empty? unless SPECIAL.empty?
SPECIAL.each do |regexp, attr| SPECIAL.each do |regexp, attr|
str.scan(regexp) do str.scan(regexp) do
attrs.set_attrs($`.length, $1.length, attr | Attribute::SPECIAL) attrs.set_attrs($`.length, $&.length, attr | Attribute::SPECIAL)
end end
end end
end end
@ -215,6 +215,8 @@ module SM
add_html("b", :BOLD) add_html("b", :BOLD)
add_html("tt", :TT) add_html("tt", :TT)
add_html("code", :TT) add_html("code", :TT)
add_special(/<!--(.*?)-->/, :COMMENT)
end end
def add_word_pair(start, stop, name) def add_word_pair(start, stop, name)
@ -293,7 +295,7 @@ module SM
# skip leading invisible text # skip leading invisible text
i = 0 i = 0
i += 1 while i < str_len and @str[i].zero? i += 1 while i < str_len and @str[i] == "\0"
start_pos = i start_pos = i
# then scan the string, chunking it on attribute changes # then scan the string, chunking it on attribute changes
@ -319,7 +321,7 @@ module SM
# move on, skipping any invisible characters # move on, skipping any invisible characters
begin begin
i += 1 i += 1
end while i < str_len and @str[i].zero? end while i < str_len and @str[i] == "\0"
end end
# tidy up trailing text # tidy up trailing text

View file

@ -13,7 +13,7 @@ module RI
# by %xx) # by %xx)
def RiWriter.internal_to_external(name) def RiWriter.internal_to_external(name)
name.gsub(/\W/) { sprintf("%%%02x", $&[0]) } name.gsub(/\W/) { "%%%02x" % $&[0].unpack('C') }
end end
# And the reverse operation # And the reverse operation