mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/optparse.rb, lib/jcode.rb, ext/tk/lib/tk.rb: reorder character
class /[\]\[]/ to /[\[\]]/ to readability. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b3344c94d
commit
e689d077e3
4 changed files with 18 additions and 13 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Mar 22 13:26:33 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* lib/optparse.rb, lib/jcode.rb, ext/tk/lib/tk.rb: reorder character
|
||||||
|
class /[\]\[]/ to /[\[\]]/ to readability.
|
||||||
|
|
||||||
Sat Mar 22 12:44:15 2003 Tanaka Akira <akr@m17n.org>
|
Sat Mar 22 12:44:15 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* lib/date/format.rb, lib/uri/common.rb: `[', `]', `-' in chracter
|
* lib/date/format.rb, lib/uri/common.rb: `[', `]', `-' in chracter
|
||||||
|
|
|
@ -605,7 +605,7 @@ module TkCore
|
||||||
end
|
end
|
||||||
|
|
||||||
def rb_appsend(interp, async, *args)
|
def rb_appsend(interp, async, *args)
|
||||||
args = args.collect!{|c| _get_eval_string(c).gsub(/[\]\[$"]/, '\\\\\&')}
|
args = args.collect!{|c| _get_eval_string(c).gsub(/[\[\]$"]/, '\\\\\&')}
|
||||||
args.push(').to_s"')
|
args.push(').to_s"')
|
||||||
appsend(interp, async, 'ruby "(', *args)
|
appsend(interp, async, 'ruby "(', *args)
|
||||||
end
|
end
|
||||||
|
@ -620,7 +620,7 @@ module TkCore
|
||||||
end
|
end
|
||||||
|
|
||||||
def rb_appsend_displayof(interp, win, async, *args)
|
def rb_appsend_displayof(interp, win, async, *args)
|
||||||
args = args.collect!{|c| _get_eval_string(c).gsub(/[\]\[$"]/, '\\\\\&')}
|
args = args.collect!{|c| _get_eval_string(c).gsub(/[\[\]$"]/, '\\\\\&')}
|
||||||
args.push(').to_s"')
|
args.push(').to_s"')
|
||||||
appsend_displayof(interp, win, async, 'ruby "(', *args)
|
appsend_displayof(interp, win, async, 'ruby "(', *args)
|
||||||
end
|
end
|
||||||
|
@ -1179,14 +1179,14 @@ class TkVariable
|
||||||
elsif val.kind_of?(Array)
|
elsif val.kind_of?(Array)
|
||||||
a = []
|
a = []
|
||||||
val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
|
val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
|
||||||
s = '"' + a.join(" ").gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
elsif val.kind_of?(Hash)
|
elsif val.kind_of?(Hash)
|
||||||
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||||
.gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
.gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; array set %s %s', @id, @id, s))
|
||||||
else
|
else
|
||||||
s = '"' + _get_eval_string(val).gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1214,7 +1214,7 @@ class TkVariable
|
||||||
|
|
||||||
def value=(val)
|
def value=(val)
|
||||||
begin
|
begin
|
||||||
s = '"' + _get_eval_string(val).gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||||
rescue
|
rescue
|
||||||
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
|
||||||
|
@ -1226,12 +1226,12 @@ class TkVariable
|
||||||
elsif val.kind_of?(Array)
|
elsif val.kind_of?(Array)
|
||||||
a = []
|
a = []
|
||||||
val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
|
val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
|
||||||
s = '"' + a.join(" ").gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
||||||
@id, @id, @id, s))
|
@id, @id, @id, s))
|
||||||
elsif val.kind_of?(Hash)
|
elsif val.kind_of?(Hash)
|
||||||
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
|
||||||
.gsub(/[\]\[$"]/, '\\\\\&') + '"'
|
.gsub(/[\[\]$"]/, '\\\\\&') + '"'
|
||||||
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
INTERP._eval(format('global %s; unset %s; array set %s %s',
|
||||||
@id, @id, @id, s))
|
@id, @id, @id, s))
|
||||||
else
|
else
|
||||||
|
@ -1438,7 +1438,7 @@ class TkVarAccess<TkVariable
|
||||||
def initialize(varname, val=nil)
|
def initialize(varname, val=nil)
|
||||||
@id = varname
|
@id = varname
|
||||||
if val
|
if val
|
||||||
s = '"' + _get_eval_string(val).gsub(/[\]\[$"]/, '\\\\\&') + '"' #"
|
s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
|
||||||
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class String
|
||||||
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
||||||
|
|
||||||
def _regex_quote(str)
|
def _regex_quote(str)
|
||||||
str.gsub(/(\\[\]\[\-\\])|\\(.)|([\]\[\\])/) do
|
str.gsub(/(\\[\[\]\-\\])|\\(.)|([\[\]\\])/) do
|
||||||
$1 || $2 || '\\' + $3
|
$1 || $2 || '\\' + $3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -965,7 +965,7 @@ Default options, which never appear in option summary.
|
||||||
raise ArgumentError, "unsupported argument type: #{o}"
|
raise ArgumentError, "unsupported argument type: #{o}"
|
||||||
when *ArgumentStyle.keys
|
when *ArgumentStyle.keys
|
||||||
style = notwice(ArgumentStyle[o], style, 'style')
|
style = notwice(ArgumentStyle[o], style, 'style')
|
||||||
when /^--no-([^\]\[=\s]*)(.+)?/
|
when /^--no-([^\[\]=\s]*)(.+)?/
|
||||||
q, a = $1, $2
|
q, a = $1, $2
|
||||||
o = notwice(a ? Object : TrueClass, klass, 'type')
|
o = notwice(a ? Object : TrueClass, klass, 'type')
|
||||||
not_pattern, not_conv = search(:atype, o) unless not_style
|
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}"
|
ldesc << "--no-#{q}"
|
||||||
long << 'no-' + (q = q.downcase)
|
long << 'no-' + (q = q.downcase)
|
||||||
nolong << q
|
nolong << q
|
||||||
when /^--\[no-\]([^\]\[=\s]*)(.+)?/
|
when /^--\[no-\]([^\[\]=\s]*)(.+)?/
|
||||||
q, a = $1, $2
|
q, a = $1, $2
|
||||||
o = notwice(a ? Object : TrueClass, klass, 'type')
|
o = notwice(a ? Object : TrueClass, klass, 'type')
|
||||||
if a
|
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_pattern, not_conv = search(:atype, FalseClass) unless not_style
|
||||||
not_style = Switch::NoArgument
|
not_style = Switch::NoArgument
|
||||||
nolong << 'no-' + o
|
nolong << 'no-' + o
|
||||||
when /^--([^\]\[=\s]*)(.+)?/
|
when /^--([^\[\]=\s]*)(.+)?/
|
||||||
q, a = $1, $2
|
q, a = $1, $2
|
||||||
if a
|
if a
|
||||||
o = notwice(NilClass, klass, 'type')
|
o = notwice(NilClass, klass, 'type')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue