* lib/optparse.rb: match incomplete (in current enconding) multibyte

string.  http://inamode6.tokuhirom.dnsalias.org/show/1551


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-11-22 14:53:16 +00:00
parent abcbaa5c6f
commit e8a83b54cb
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Tue Nov 22 23:52:06 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb: match incomplete (in current enconding) multibyte
string. http://inamode6.tokuhirom.dnsalias.org/show/1551
Tue Nov 22 18:36:11 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* win32/win32.c (winnt_stat): set mapped errno instead of ENOENT.

View File

@ -533,7 +533,7 @@ class OptionParser
#
# See OptionParser.accept.
#
def accept(t, pat = /.*/, &block)
def accept(t, pat = /.*/nm, &block)
if pat
pat.respond_to?(:match) or raise TypeError, "has no `match'"
else
@ -1310,7 +1310,7 @@ class OptionParser
while arg = argv.shift
case arg
# long option
when /\A--([^=]*)(?:=(.*))?/
when /\A--([^=]*)(?:=(.*))?/nm
opt, rest = $1, $2
begin
sw, = complete(:long, opt, true)
@ -1325,7 +1325,7 @@ class OptionParser
end
# short option
when /\A-(.)((=).*|.+)?/
when /\A-(.)((=).*|.+)?/nm
opt, has_arg, eq, val, rest = $1, $3, $3, $2, $2
begin
unless sw = search(:short, opt)
@ -1545,7 +1545,7 @@ class OptionParser
: String
any none-empty string, and no conversion.
=end #'#"#`#
accept(String, /.+/) {|s,*|s}
accept(String, /.+/nm) {|s,*|s}
=begin
: Integer