class Mutest::AST::Regexp::Transformer::Quantifier::ASTToExpression

Mapper from `Parser::AST::Node` to `Regexp::Expression`

Constants

QUANTIFIER_MAP
Quantifier

Private Instance Methods

mode() click to toggle source

The quantifier “mode”

@return [Symbol] :greedy, :possessive, or :reluctant

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 87
def mode
  quantifier.mode
end
quantifier() click to toggle source

Quantifier mapping information for current node

@return [Quantifier]

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 94
def quantifier
  QUANTIFIER_MAP.fetch(node.type)
end
suffix() click to toggle source

Regexp symbols used to specify quantifier

@return [String]

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 80
def suffix
  quantifier.suffix
end
text() click to toggle source

Quantifier text

@return [String]

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 62
def text
  if type.equal?(:interval)
    Interval.new(min, max).to_s + suffix
  else
    suffix
  end
end
transform() click to toggle source

Transform ast into quantifier attached to expression

@return [Regexp::Expression::Base]

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 53
def transform
  Regexp.to_expression(subject).dup.tap do |expression|
    expression.quantify(type, text, min, max, mode)
  end
end
type() click to toggle source

Type of quantifier

@return [Symbol] :zero_or_more, :one_or_more, or :interval

# File lib/mutest/ast/regexp/transformer/quantifier.rb, line 73
def type
  quantifier.type
end