Sha256: 484bad39b52f4a7193255f20ef58504ca109274c580064a128f9bf2385a37016

Contents?: true

Size: 983 Bytes

Versions: 21

Compression:

Stored size: 983 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

21 entries across 21 versions & 1 rubygems

Version Path
scoped_search-4.1.12 lib/scoped_search/query_language.rb
scoped_search-4.1.11 lib/scoped_search/query_language.rb
scoped_search-4.1.10 lib/scoped_search/query_language.rb
scoped_search-4.1.9 lib/scoped_search/query_language.rb
scoped_search-4.1.8 lib/scoped_search/query_language.rb
scoped_search-4.1.7 lib/scoped_search/query_language.rb
scoped_search-4.1.6 lib/scoped_search/query_language.rb
scoped_search-4.1.5 lib/scoped_search/query_language.rb
scoped_search-4.1.4 lib/scoped_search/query_language.rb
scoped_search-4.1.3 lib/scoped_search/query_language.rb
scoped_search-4.1.2 lib/scoped_search/query_language.rb
scoped_search-4.1.1 lib/scoped_search/query_language.rb
scoped_search-4.1.0 lib/scoped_search/query_language.rb
scoped_search-4.0.0 lib/scoped_search/query_language.rb
scoped_search-3.3.0 lib/scoped_search/query_language.rb
scoped_search-3.2.2 lib/scoped_search/query_language.rb
scoped_search-3.2.1 lib/scoped_search/query_language.rb
scoped_search-3.2.0 lib/scoped_search/query_language.rb
scoped_search-3.1.0 lib/scoped_search/query_language.rb
scoped_search-3.0.1 lib/scoped_search/query_language.rb