Class: Yuriita::QueryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/yuriita/query_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lexer: Lexer, parser: Parser) ⇒ QueryBuilder

Returns a new instance of QueryBuilder.



7
8
9
10
# File 'lib/yuriita/query_builder.rb', line 7

def initialize(lexer: Lexer, parser: Parser)
  @lexer = Lexer
  @parser = Parser
end

Class Method Details

.build(input) ⇒ Object



3
4
5
# File 'lib/yuriita/query_builder.rb', line 3

def self.build(input)
  new.build(input)
end

Instance Method Details

#build(input) ⇒ Object



12
13
14
15
16
17
# File 'lib/yuriita/query_builder.rb', line 12

def build(input)
  tokens = lexer.lex(input)
  parser.parse(tokens)
rescue RLTK::LexingError, RLTK::NotInLanguage, RLTK::BadToken, EOFError
  raise ParseError
end