Sha256: 331cc286118943c67120d4dad9ad0e64a8776b4e0b9c6e1fd40d7cdb355c96d9

Contents?: true

Size: 911 Bytes

Versions: 6

Compression:

Stored size: 911 Bytes

Contents

grammar SQLWhereCondition
  include SQLKeyValuePair

  rule where_condition
    "WHERE" SPACE where_clause {
       def eval
         where_clause.eval
       end
     }
  end

  rule where_clause
    OPEN_PARENS optional_spaces where_clause optional_spaces CLOSE_PARENS {
      def eval
        where_clause.eval
      end
    }
    /
    clause1:single_expression_where_clause      SPACE 
            disjunction_or_conjunction_joiner   SPACE 
    clause2:where_clause {
      def eval
        klass = Expressions.find_class_for(disjunction_or_conjunction_joiner.eval)
        klass.new(clause1.eval, clause2.eval)
      end
    } 
    / 
    single_expression_where_clause
  end

  rule disjunction_or_conjunction_joiner
    and / or
  end

  rule and
    "AND" { def eval; :AND; end }
  end

  rule or
    "OR" { def eval; :OR; end }
  end

  rule single_expression_where_clause
    key_value_pair
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hipster_sql_to_hbase-0.1.7 lib/sql_parser/sql_where_condition.treetop
hipster_sql_to_hbase-0.1.6 lib/sql_parser/sql_where_condition.treetop
hipster_sql_to_hbase-0.1.5 lib/sql_parser/sql_where_condition.treetop
hipster_sql_to_hbase-0.1.4 lib/sql_parser/sql_where_condition.treetop
hipster_sql_to_hbase-0.1.3 lib/sql_parser/sql_where_condition.treetop
hipster_sql_to_hbase-0.1.2 lib/sql_parser/sql_where_condition.treetop