Sha256: 82008a1363bf3eb48f85942558f2cb34257d48e31b7eae72fe6097c227ad4bd3

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

module Mutant

  # The list of ruby kewords from http://ruby-doc.org/docs/keywords/1.9/
  KEYWORDS = %w(
    BEGIN END __ENCODING__ __END__ __FILE__
    __LINE__ alias and begin break case class
    def define do else elsif end ensure false
    for if in module next nil not or redo
    rescue retry return self super then true
    undef unless until when while yield
  ).map(&:to_sym).to_set.freeze

  BINARY_METHOD_OPERATOR_EXPANSIONS = {
    :<=>  => :spaceship_operator,
    :===  => :case_equality_operator,
    :[]=  => :element_writer,
    :[]   => :element_reader,
    :<=   => :less_than_or_equal_to_operator,
    :>=   => :greater_than_or_equal_to_operator,
    :==   => :equality_operator,
    :'!~' => :nomatch_operator,
    :'!=' => :inequality_operator,
    :=~   => :match_operator,
    :<<   => :left_shift_operator,
    :>>   => :right_shift_operator,
    :**   => :exponentation_operator,
    :*    => :multiplication_operator,
    :%    => :modulo_operator,
    :/    => :division_operator,
    :|    => :bitwise_or_operator,
    :^    => :bitwise_xor_operator,
    :&    => :bitwise_and_operator,
    :<    => :less_than_operator,
    :>    => :greater_than_operator,
    :+    => :addition_operator,
    :-    => :substraction_operator
  }.freeze

  UNARY_METHOD_OPERATOR_EXPANSIONS = {
    :~@   => :unary_match_operator,
    :+@   => :unary_addition_operator,
    :-@   => :unary_substraction_operator,
    :'!'  => :negation_operator
  }.freeze

  BINARY_METHOD_OPERATORS = BINARY_METHOD_OPERATOR_EXPANSIONS.keys.to_set.freeze

  OPERATOR_EXPANSIONS = BINARY_METHOD_OPERATOR_EXPANSIONS.merge(UNARY_METHOD_OPERATOR_EXPANSIONS).freeze
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.2.20 lib/mutant/constants.rb
mutant-0.2.17 lib/mutant/constants.rb
mutant-0.2.16 lib/mutant/constants.rb
mutant-0.2.15 lib/mutant/constants.rb
mutant-0.2.14 lib/mutant/constants.rb
mutant-0.2.13 lib/mutant/constants.rb