# File lib/rcodetools/completion.rb, line 11 def fill_literal!(expr) [ "\"", "'", "`" ].each do |q| expr.gsub!(/#{q}(.+)#{q}/){ '"' + "x"*$1.length + '"' } end expr.gsub!(/(%([wWqQxrs])?(\W))(.+?)\3/){ percent = $2 == 'x' ? '%'+$3 : $1 # avoid executing shell command percent + "x"*$4.length + $3 } [ %w[( )], %w[{ }], %w![ ]!, %w[< >] ].each do |b,e| rb, re = [b,e].map{ |x| Regexp.quote(x)} expr.gsub!(/(%([wWqQxrs])?(#{rb}))(.+)#{re}/){ percent = $2 == 'x' ? '%'+$3 : $1 # avoid executing shell command percent + "x"*$4.length + e } end end