mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
108cf940d8
commit
58ef7c2088
14 changed files with 56 additions and 46 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue