XPath compiler support for the parent axis

This commit is contained in:
Yorick Peterse 2015-08-03 09:39:00 +02:00
parent ca7930cbf4
commit bc49af02a2
1 changed files with 13 additions and 0 deletions

View File

@ -244,6 +244,19 @@ module Oga
end
end
# @param [AST::Node] ast
# @param [Oga::Ruby::Node] input
# @return [Oga::Ruby::Node]
def on_axis_parent(ast, input, &block)
node = node_literal
input.is_a?(XML::Node).if_true do
backup_variable(node, input.parent) do
process(ast, node, &block).if_true { yield node }
end
end
end
# @param [AST::Node] ast
# @param [Oga::Ruby::Node] input
# @return [Oga::Ruby::Node]