Sha256: db4bcc93167adf78f83258ee6d31dd217e8d5041fe27a8ecd60197e6114e9549

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

require_relative 'agg_operator'

module DDQL
  class LookupOperator < AggOperator
    def initialize
      super("LOOKUP BY", "Lookup", type: :infix, return_type: :string)
    end

    def parse(parser, token, expression: nil)
      precedence      = self.precedence
      precedence     -= 1 if right?
      next_expression = parser.parse(precedence: precedence)
      op_expression   = token.as_hash
      
      {
        left: expression,
        op: op_expression[:op],
        right: next_expression.delete(:left) || next_expression,
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddql-1.0.0 lib/ddql/lookup_operator.rb