diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-21 15:13:23 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-21 15:13:23 +0000 |
commit | 58ef7c20880642c88d06b351f8bbaaa291898e58 (patch) | |
tree | 0ed5f63dd297a8bcc2dc5fa5e35b3e84a19a6ca2 /lib/optparse.rb | |
parent | 108cf940d8d617dcabb5e5b17e6315b023ecc301 (diff) |
* regex.c (re_compile_pattern): fix previous change.
* instruby.rb, ext/extmk.rb, ext/tk/lib/tk.rb, lib/benchmark.rb,
lib/cgi.rb, lib/debug.rb, lib/getoptlong.rb, lib/jcode.rb,
lib/optparse.rb, lib/time.rb, lib/date/format.rb,
lib/irb/ruby-lex.rb: escape `[', `]', `-' in chracter class in
regexp to avoid warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r-- | lib/optparse.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index d7003c6fa4..1da5ef2cc0 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -965,7 +965,7 @@ Default options, which never appear in option summary. raise ArgumentError, "unsupported argument type: #{o}" when *ArgumentStyle.keys style = notwice(ArgumentStyle[o], style, 'style') - when /^--no-([^][=\s]*)(.+)?/ + when /^--no-([^\]\[=\s]*)(.+)?/ q, a = $1, $2 o = notwice(a ? Object : TrueClass, klass, 'type') not_pattern, not_conv = search(:atype, o) unless not_style @@ -975,7 +975,7 @@ Default options, which never appear in option summary. ldesc << "--no-#{q}" long << 'no-' + (q = q.downcase) nolong << q - when /^--\[no-\]([^][=\s]*)(.+)?/ + when /^--\[no-\]([^\]\[=\s]*)(.+)?/ q, a = $1, $2 o = notwice(a ? Object : TrueClass, klass, 'type') if a @@ -987,7 +987,7 @@ Default options, which never appear in option summary. not_pattern, not_conv = search(:atype, FalseClass) unless not_style not_style = Switch::NoArgument nolong << 'no-' + o - when /^--([^][=\s]*)(.+)?/ + when /^--([^\]\[=\s]*)(.+)?/ q, a = $1, $2 if a o = notwice(NilClass, klass, 'type') @@ -1346,14 +1346,14 @@ Default options, which never appear in option summary. hex = 'x[\da-f]+(?:_[\da-f]+)*' octal = "0(?:[0-7]*(?:_[0-7]+)*|#{binary}|#{hex})" integer = "#{octal}|#{decimal}" - accept(Integer, %r"\A[-+]?(?:#{integer})"io) {|s| Integer(s) if s} + accept(Integer, %r"\A[\-+]?(?:#{integer})"io) {|s| Integer(s) if s} =begin : Float Float number format, and converts to (({Float})). =end #'#"#`# - float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?" - floatpat = %r"\A[-+]?#{float}"io + float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[\\-+]?#{decimal})?" + floatpat = %r"\A[\-+]?#{float}"io accept(Float, floatpat) {|s| s.to_f if s} =begin @@ -1361,13 +1361,13 @@ Default options, which never appear in option summary. Generic numeric format, and converts to (({Integer})) for integer format, (({Float})) for float format. =end #'#"#`# - accept(Numeric, %r"\A[-+]?(?:#{octal}|#{float})"io) {|s| eval(s) if s} + accept(Numeric, %r"\A[\-+]?(?:#{octal}|#{float})"io) {|s| eval(s) if s} =begin : OptionParser::DecimalInteger Decimal integer format, to be converted to (({Integer})). =end #'#"#`# - DecimalInteger = /\A[-+]?#{decimal}/io + DecimalInteger = /\A[\-+]?#{decimal}/io accept(DecimalInteger) {|s| s.to_i if s} =begin @@ -1375,7 +1375,7 @@ Default options, which never appear in option summary. Ruby/C like octal/hexadecimal/binary integer format, to be converted to (({Integer})). =end #'#"#`# - OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))/io + OctalInteger = /\A[\-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))/io accept(OctalInteger) {|s| s.oct if s} =begin |