method
parse_args
v2_1_10 -
Show latest stable
- Class:
REXML::Parsers::XPathParser
parse_args( string )private
No documentation available.
# File lib/rexml/parsers/xpathparser.rb, line 652
def parse_args( string )
arguments = []
ind = 0
inquot = false
inapos = false
depth = 1
begin
case string[ind]
when ""
inquot = !inquot unless inapos
when ''
inapos = !inapos unless inquot
else
unless inquot or inapos
case string[ind]
when ((
depth += 1
if depth == 1
string = string[1..-1]
ind -= 1
end
when ))
depth -= 1
if depth == 0
s = string[0,ind].strip
arguments << s unless s == ""
string = string[ind+1..-1]
end
when ,,
if depth == 1
s = string[0,ind].strip
arguments << s unless s == ""
string = string[ind+1..-1]
ind = -1
end
end
end
end
ind += 1
end while depth > 0 and ind < string.length
return nil unless depth==0
[string,arguments]
end