free_mutant/lib/mutant/constants.rb

43 lines
1.2 KiB
Ruby
Raw Normal View History

# encoding: utf-8
module Mutant
2013-12-05 16:42:54 +01:00
# Set of nodes that cannot be on the LHS of an assignment
NOT_ASSIGNABLE = symbolset %w(
int float str dstr class module self
)
2013-12-05 16:42:54 +01:00
# Set of op-assign types
OP_ASSIGN = symbolset %w(or_asgn and_asgn op_asgn)
# Set of node types that are not valid when emitted standalone
NOT_STANDALONE = symbolset %w( splat restarg block_pass)
INDEX_OPERATORS = symbolset %w([] []=)
UNARY_METHOD_OPERATORS = symbolset %w(~@ +@ -@ !)
2013-12-05 16:42:54 +01:00
# Operators ruby implementeds as methods
METHOD_OPERATORS = symbolset %w(
2013-12-05 16:42:54 +01:00
<=> === []= [] <= >= == !~ != =~ <<
>> ** * % / | ^ & < > + - ~@ +@ -@ !
)
BINARY_METHOD_OPERATORS = (
2013-12-05 16:42:54 +01:00
METHOD_OPERATORS - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)
).to_set.freeze
2013-12-05 16:42:54 +01:00
OPERATOR_METHODS = (
METHOD_OPERATORS + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
).to_set.freeze
# Nodes that are NOT handled by mutant.
2013-12-05 16:42:54 +01:00
#
# not - 1.8 only, mutant does not support 1.8
2013-12-05 16:42:54 +01:00
#
NODE_BLACKLIST = symbolset %w(not)
# Nodes that are NOT generated by parser but used by mutant / unparser.
NODE_EXTRA = symbolset %w(empty)
NODE_TYPES = ((Parser::Meta::NODE_TYPES + NODE_EXTRA) - NODE_BLACKLIST).to_set.freeze
end # Mutant