Class: ScopedSearch::QueryLanguage::Compiler

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Parser, Tokenizer
Defined in:
lib/scoped_search/query_language.rb

Constant Summary

Constants included from Parser

Parser::ALL_INFIX_OPERATORS, Parser::ALL_PREFIX_OPERATORS, Parser::COMPARISON_OPERATORS, Parser::DEFAULT_SEQUENCE_OPERATOR, Parser::LOGICAL_INFIX_OPERATORS, Parser::LOGICAL_PREFIX_OPERATORS, Parser::NULL_PREFIX_OPERATORS

Constants included from Tokenizer

Tokenizer::KEYWORDS, Tokenizer::OPERATORS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Parser

#parse, #parse_comparison, #parse_expression_sequence, #parse_infix_comparison, #parse_logical_expression, #parse_logical_not_expression, #parse_null_expression, #parse_prefix_comparison, #parse_value

Methods included from Tokenizer

#current_char, #each_token, #next_char, #peek_char, #tokenize, #tokenize_keyword, #tokenize_operator, #tokenize_quoted_keyword

Constructor Details

#initialize(str) ⇒ Compiler

Returns a new instance of Compiler.



13
14
15
# File 'lib/scoped_search/query_language.rb', line 13

def initialize(str)
  @str = str
end

Class Method Details

.parse(str) ⇒ Object



17
18
19
20
# File 'lib/scoped_search/query_language.rb', line 17

def self.parse(str)
  compiler = self.new(str)
  compiler.parse
end

.tokenize(str) ⇒ Object



22
23
24
25
# File 'lib/scoped_search/query_language.rb', line 22

def self.tokenize(str)
  compiler = self.new(str)
  compiler.tokenize
end