diff options
author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-03 02:22:38 +0000 |
---|---|---|
committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-03 02:22:38 +0000 |
commit | d1a2925eee6a1d79f01c459024359bdfacb33de4 () | |
tree | 6a3f799caa21d20e16c572c707aeea7d54d29870 /lib/rexml/xpath_parser.rb | |
parent | 08cd3453b246e3c968d56ef1e7a4505378621db5 (diff) |
* Fixed a bug in the evaluation of XPath's 'or'
* deprecated #type changed to class.name * XPath's union was was being incorrectly interpreted git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rexml/xpath_parser.rb | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -113,11 +113,6 @@ module REXML when :node return nodeset - #n = nodeset.clone - #n.delete_if do |node| - # !node.node? - #end - #return n # FIXME: I suspect the following XPath will fail: # /a/*/*[1] @@ -351,7 +346,7 @@ module REXML right = Predicate( predicate.shift, node ) return equality_relational_compare( left, eq, right ) - when :div, :mod, :mult, :plus, :minus, :union op = predicate.shift left = Predicate( predicate.shift, node ) right = Predicate( predicate.shift, node ) @@ -368,10 +363,14 @@ module REXML return left + right when :minus return left - right - when :union - return (left | right) end when :neg predicate.shift operand = Functions::number(Predicate( predicate, node )) @@ -426,11 +425,16 @@ module REXML end def equality_relational_compare( set1, op, set2 ) - #puts "EQ_REL_COMP: #{set1.to_s}, #{op}, #{set2.to_s}" if set1.kind_of? Array and set2.kind_of? Array if set1.size == 1 and set2.size == 1 set1 = set1[0] set2 = set2[0] else set1.each do |i1| i1 = i1.to_s @@ -442,7 +446,7 @@ module REXML return false end end - #puts "COMPARING VALUES" # If one is nodeset and other is number, compare number to each item # in nodeset s.t. number op number(string(item)) # If one is nodeset and other is string, compare string to each item @@ -450,7 +454,7 @@ module REXML # If one is nodeset and other is boolean, compare boolean to each item # in nodeset s.t. boolean op boolean(item) if set1.kind_of? Array or set2.kind_of? Array - #puts "ISA ARRAY" if set1.kind_of? Array a = set1 b = set2.to_s @@ -510,12 +514,14 @@ module REXML end end #puts "EQ_REL_COMP: #{set1} #{op} #{set2}" return compare( set1, op, set2 ) end return false end def compare a, op, b case op when :eq a == b |