predicate (REXML::QuickPath)

    # File temp/quickpath.rb, line 160
                    def QuickPath::predicate( elements, path )
                            ind = 1
                            bcount = 1
                            while bcount > 0
                                    bcount += 1 if path[ind] == ?[
                                    bcount -= 1 if path[ind] == ?]
                                    ind += 1
                            end
                            ind -= 1
                            predicate = path[1..ind-1]
                            rest = path[ind+1..-1]

                            # have to change 'a [=<>] b [=<>] c' into 'a [=<>] b and b [=<>] c'
                            predicate.gsub!( /([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)\s*([<>=])\s*([^\s(and)(or)<>=]+)/u ) {
                                    "#$1 #$2 #$3 and #$3 #$4 #$5"
                            }
                            # Let's do some Ruby trickery to avoid some work:
                            predicate.gsub!( /&/u, "&&" )
                            predicate.gsub!( /=/u, "==" )
                            predicate.gsub!( /@(\w[-\w.]*)/u ) {
                                    "attribute(\"#$1\")"
                            }
                            predicate.gsub!( /\bmod\b/u, "%" )
                            predicate.gsub!( /\b(\w[-\w.]*\()/u ) {
                                    fname = $1
                                    fname.gsub( /-/u, "_" )
                            }

                            Functions.pair = [ 0, elements.size ]
                            results = []
                            elements.each do |element|
                                    Functions.pair[0] += 1
                                    Functions.node = element
                                    res = eval( predicate )
                                    case res
                                    when true
                                            results << element
                                    when Fixnum
                                            results << element if Functions.pair[0] == res
                                    when String
                                            results << element
                                    end
                            end
                            return filter( results, rest )
                    end