From f10b7aa065d5639357c072042148c4c95d60de06 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 22 Jun 2015 23:49:09 +0200 Subject: [PATCH] Super basic boilerplate for the XPath compiler --- lib/oga.rb | 1 + lib/oga/xpath/compiler.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 lib/oga/xpath/compiler.rb diff --git a/lib/oga.rb b/lib/oga.rb index ff53482..9553712 100644 --- a/lib/oga.rb +++ b/lib/oga.rb @@ -52,6 +52,7 @@ require 'oga/html/entities' require 'oga/xpath/lexer' require 'oga/xpath/parser' require 'oga/xpath/evaluator' +require 'oga/xpath/compiler' require 'oga/css/lexer' require 'oga/css/parser' diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb new file mode 100644 index 0000000..507381a --- /dev/null +++ b/lib/oga/xpath/compiler.rb @@ -0,0 +1,14 @@ +module Oga + module XPath + ## + # Compiling of XPath ASTs into Ruby source code. + # + # The Compiler class can be used to turn an XPath AST into Ruby source code + # that can be executed to match XML nodes in a given input document/element. + # Compiled source code is cached per expression, removing the need for + # recompiling the same expression over and over again. + # + class Compiler + end # Compiler + end # XPath +end # Oga