class Mutest::AST::Regexp::Transformer::ExpressionToAST
Abstract expression transformer
Constants
- PREFIX
Private Instance Methods
ast(*children)
click to toggle source
Node with provided children using node type constructed in `type`
@param [Object,Parser::AST::Node] child of node
@return [Parser::AST::Node]
# File lib/mutest/ast/regexp/transformer.rb, line 68 def ast(*children) s(type, *children) end
children()
click to toggle source
Transformed children of expression
@return [Array<Parser::AST::Node>]
# File lib/mutest/ast/regexp/transformer.rb, line 90 def children expression.expressions.map(&Regexp.method(:to_ast)) end
quantify(node)
click to toggle source
Wrap provided node in a quantifier
@param node [Parser::AST::Node]
@return [Parser::AST::Node]
quantifier node wrapping provided node if expression is quantified
@return [Parser::AST::Node]
original node otherwise
# File lib/mutest/ast/regexp/transformer.rb, line 81 def quantify(node) return node unless expression.quantified? Quantifier.to_ast(expression.quantifier).append(node) end
type()
click to toggle source
Node type constructed from token and type of `Regexp::Expression`
@return [Symbol]
# File lib/mutest/ast/regexp/transformer.rb, line 97 def type :"#{PREFIX}_#{expression.token}_#{expression.type}" end