parse_args( string ) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rexml/parsers/xpathparser.rb, line 653
      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
Register or log in to add new notes.