mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1a6ce22dfa
commit
7aefa8e580
2 changed files with 14 additions and 15 deletions
|
@ -2,11 +2,6 @@ Mon Sep 26 20:59:28 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* parse.y: changed to ANSI function style.
|
* parse.y: changed to ANSI function style.
|
||||||
|
|
||||||
Mon Sep 26 07:55:06 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|
||||||
|
|
||||||
* lib/optparse.rb (RequiredArgument#parse): not consume unmatched
|
|
||||||
argument. fixed [ruby-dev:27316]
|
|
||||||
|
|
||||||
Sun Sep 25 12:02:04 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
Sun Sep 25 12:02:04 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
* bin/erb: typo fixed.
|
* bin/erb: typo fixed.
|
||||||
|
|
|
@ -453,15 +453,12 @@ class OptionParser
|
||||||
#
|
#
|
||||||
# Raises an exception if argument is not present.
|
# Raises an exception if argument is not present.
|
||||||
#
|
#
|
||||||
def parse(arg, argv, &error)
|
def parse(arg, argv)
|
||||||
opt = (val = parse_arg(val, &error))[1]
|
unless arg
|
||||||
val = conv_arg(*val)
|
raise MissingArgument if argv.empty?
|
||||||
if opt and !arg
|
arg = argv.shift
|
||||||
argv.shift
|
|
||||||
else
|
|
||||||
val[0] = nil
|
|
||||||
end
|
end
|
||||||
val
|
conv_arg(*parse_arg(arg) {|*exc| raise(*exc)})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -484,7 +481,7 @@ class OptionParser
|
||||||
#
|
#
|
||||||
# Switch that takes an argument, which does not begin with '-'.
|
# Switch that takes an argument, which does not begin with '-'.
|
||||||
#
|
#
|
||||||
class PlacedArgument < RequiredArgument
|
class PlacedArgument < self
|
||||||
#
|
#
|
||||||
# Returns nil if argument is not present or begins with '-'.
|
# Returns nil if argument is not present or begins with '-'.
|
||||||
#
|
#
|
||||||
|
@ -492,7 +489,14 @@ class OptionParser
|
||||||
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
|
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
|
||||||
return nil, block, nil
|
return nil, block, nil
|
||||||
end
|
end
|
||||||
super
|
opt = (val = parse_arg(val, &error))[1]
|
||||||
|
val = conv_arg(*val)
|
||||||
|
if opt and !arg
|
||||||
|
argv.shift
|
||||||
|
else
|
||||||
|
val[0] = nil
|
||||||
|
end
|
||||||
|
val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue