Method: REXML::Parsers::XPathParser#parse

Defined in:
lib/rexml/parsers/xpathparser.rb

#parse(path) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rexml/parsers/xpathparser.rb', line 21

def parse path
  path = path.dup
  path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
  path.gsub!( /\s+([\]\)])/, '\1')
  parsed = []
  rest = OrExpr(path, parsed)
  if rest
    unless rest.strip.empty?
      raise ParseException.new("Garbage component exists at the end: " +
                               "<#{rest}>: <#{path}>")
    end
  end
  parsed
end