Class: Mutant::AST::Regexp::Transformer::Direct Private

Inherits:
Mutant::AST::Regexp::Transformer show all
Defined in:
lib/mutant/ast/regexp/transformer/direct.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Transformer for nodes which map directly to other domain

A node maps “directly” to another domain if the node never has children or text which needs to be preserved for a mapping

Examples:

direct mapping


input      = /\d/
expression = Regexp::Parser.parse(input).first
node       = Transformer::Direct.to_ast(expression)

# the digit type always has the same text and no children
expression.text      # => "\\d"
expression.terminal? # => true

# therefore the `Parser::AST::Node` is always the same
node # => s(:regexp_digit_type)

Defined Under Namespace

Classes: ASTToExpression, ExpressionToAST

Constant Summary

Constants inherited from Mutant::AST::Regexp::Transformer

REGISTRY

Method Summary

Methods inherited from Mutant::AST::Regexp::Transformer

lookup, to_ast, to_expression