summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-01 09:25:37 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-01 09:25:37 +0000
commit56160fa00424ee3aecd14b72457ad19d34dc2c26 (patch)
treeebd326e315572f9712a37a81ab46c35dea88f1b5 /lib
parent7e74039572825048f021214f746badb938d65694 (diff)
downloadruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.tar.gz
ruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.tar.xz
ruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.zip
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/shellwords.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/shellwords.rb b/lib/shellwords.rb
index 7b16c6cb5..5c31f8ca7 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -16,27 +16,27 @@ module Shellwords
unless line.kind_of?(String)
raise ArgumentError, "Argument must be String class object."
end
- line.sub!(/^\s+/, '')
+ line.sub!(/\A\s+/, '')
words = []
while line != ''
field = ''
while true
- if line.sub!(/^"(([^"\\]|\\.)*)"/, '') then #"
+ if line.sub!(/\A"(([^"\\]|\\.)*)"/, '') then #"
snippet = $1
snippet.gsub!(/\\(.)/, '\1')
- elsif line =~ /^"/ then #"
+ elsif line =~ /\A"/ then #"
raise ArgumentError, "Unmatched double quote: #{line}"
- elsif line.sub!(/^'(([^'\\]|\\.)*)'/, '') then #'
+ elsif line.sub!(/\A'(([^'\\]|\\.)*)'/, '') then #'
snippet = $1
snippet.gsub!(/\\(.)/, '\1')
- elsif line =~ /^'/ then #'
+ elsif line =~ /\A'/ then #'
raise ArgumentError, "Unmatched single quote: #{line}"
- elsif line.sub!(/^\\(.)/, '') then
+ elsif line.sub!(/\A\\(.)/, '') then
snippet = $1
- elsif line.sub!(/^([^\s\\'"]+)/, '') then #'
+ elsif line.sub!(/\A([^\s\\'"]+)/, '') then #'
snippet = $1
else
- line.sub!(/^\s+/, '')
+ line.sub!(/\A\s+/, '')
break
end
field.concat(snippet)