module Mutest::AST::Regexp
Regexp
source mapper
Constants
- UNSUPPORTED_EXPRESSION_TYPE
Public Class Methods
parse(regexp)
click to toggle source
Parse regex string into expression
@param regexp [String]
@return [Regexp::Expression::Base]
# File lib/mutest/ast/regexp.rb, line 14 def self.parse(regexp) ::Regexp::Parser.parse(regexp) end
supported?(expression)
click to toggle source
Check if expression is supported by mapper
@param expression [Regexp::Expression::Base]
@return [Boolean]
# File lib/mutest/ast/regexp.rb, line 23 def self.supported?(expression) expression.terminal? || expression.all? do |subexp| !subexp.type.equal?(UNSUPPORTED_EXPRESSION_TYPE) && supported?(subexp) end end
to_ast(expression)
click to toggle source
Convert expression into ast node
@param expression [Regexp::Expression::Base]
@return [Parser::AST::Node]
# File lib/mutest/ast/regexp.rb, line 34 def self.to_ast(expression) ast_type = :"regexp_#{expression.token}_#{expression.type}" Transformer.lookup(ast_type).to_ast(expression) end
to_expression(node)
click to toggle source
Convert node into expression
@param node [Parser::AST::Node]
@return [Regexp::Expression::Base]
# File lib/mutest/ast/regexp.rb, line 45 def self.to_expression(node) Transformer.lookup(node.type).to_expression(node) end