class ScopedSearch::QueryLanguage::Compiler

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).

Public Class Methods

parse(str) click to toggle source

Parser a query string to return an abstract syntax tree.

# File lib/scoped_search/query_language.rb, line 24
def self.parse(str)
  compiler = self.new(str)
  compiler.parse
end
tokenize(str) click to toggle source

Tokenizes a query string to return a stream of tokens.

# File lib/scoped_search/query_language.rb, line 30
def self.tokenize(str)
  compiler = self.new(str)
  compiler.tokenize
end