From d1f1aa820f6367af03686252ccb7c43f325e7b43 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 22 Nov 2005 14:53:16 +0000 Subject: * 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/branches/ruby_1_8@9589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/optparse.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/optparse.rb') diff --git a/lib/optparse.rb b/lib/optparse.rb index 6668f30c8b..b6ee6c896c 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -521,7 +521,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 @@ -1272,7 +1272,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) @@ -1287,7 +1287,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) @@ -1500,7 +1500,7 @@ class OptionParser : String any none-empty string, and no conversion. =end #'#"#`# - accept(String, /.+/) {|s,*|s} + accept(String, /.+/nm) {|s,*|s} =begin : Integer -- cgit v1.2.3