From 43dab548e9aa6d748627e8e8a2d1938ca4b9cd9b Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 18 Aug 2015 14:27:38 +0200 Subject: [PATCH] XPath compiler support for not() --- lib/oga/xpath/compiler.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index 20cdcc6..ce99cfc 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -914,6 +914,18 @@ module Oga end end + # @param [Oga::Ruby::Node] input + # @param [AST::Node] arg + # @return [Oga::Ruby::Node] + def on_call_not(input, arg) + arg_ast = try_match_first_node(arg, input) + call_arg = unique_literal(:call_arg) + conversion = literal(Conversion) + + call_arg.assign(arg_ast) + .followed_by(conversion.to_boolean(call_arg).not) + end + ## # Delegates type tests to specific handlers. #