Sha256: 8c3d4aef3897eddd859ec6e5b13becf4398f0b144825427d38d4e665ea3238af

Contents?: true

Size: 986 Bytes

Versions: 22

Compression:

Stored size: 986 Bytes

Contents

module ScopedSearch::QueryLanguage

  require 'scoped_search/query_language/ast'
  require 'scoped_search/query_language/tokenizer'
  require 'scoped_search/query_language/parser'

  # The Compiler class can compile a query string into an Abstract Syntax Tree,
  # which in turn is used to build the SQL query.
  #
  # This class inclused the Tokenizer module to transform the query stream into
  # a stream of tokens, and includes the Parser module that will transform the
  # stream of tokens into an Abstract Syntax Tree (AST).
  class Compiler

    include Tokenizer
    include Parser
    include Enumerable

    def initialize(str) # :nodoc:
      @str = str
    end

    # Parser a query string to return an abstract syntax tree.
    def self.parse(str)
      compiler = self.new(str)
      compiler.parse
    end

    # Tokenizes a query string to return a stream of tokens.
    def self.tokenize(str)
      compiler = self.new(str)
      compiler.tokenize
    end

  end
end


Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
scoped_search-2.7.1 lib/scoped_search/query_language.rb
scoped_search-2.7.0 lib/scoped_search/query_language.rb
scoped_search-2.6.5 lib/scoped_search/query_language.rb
scoped_search-2.6.4 lib/scoped_search/query_language.rb
scoped_search-2.6.3 lib/scoped_search/query_language.rb
scoped_search-2.6.2 lib/scoped_search/query_language.rb
scoped_search-2.6.1 lib/scoped_search/query_language.rb
scoped_search-2.6.0 lib/scoped_search/query_language.rb
scoped_search-2.5.1 lib/scoped_search/query_language.rb
scoped_search-2.5.0 lib/scoped_search/query_language.rb
scoped_search-2.4.1 lib/scoped_search/query_language.rb
scoped_search-2.4.0 lib/scoped_search/query_language.rb
scoped_search-2.3.7 lib/scoped_search/query_language.rb
scoped_search-2.3.6 lib/scoped_search/query_language.rb
scoped_search-2.3.5 lib/scoped_search/query_language.rb
scoped_search-2.3.4 lib/scoped_search/query_language.rb
scoped_search-2.3.3 lib/scoped_search/query_language.rb
scoped_search-2.3.1 lib/scoped_search/query_language.rb
scoped_search-2.3.0 lib/scoped_search/query_language.rb
scoped_search-2.2.1 lib/scoped_search/query_language.rb