Class: YARP::BackReferenceReadNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents reading a reference to a field in the previous match.

$'
^^

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ BackReferenceReadNode

def initialize: (location: Location) -> void



612
613
614
# File 'lib/yarp/node.rb', line 612

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



617
618
619
# File 'lib/yarp/node.rb', line 617

def accept(visitor)
  visitor.visit_back_reference_read_node(self)
end

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



622
623
624
# File 'lib/yarp/node.rb', line 622

def child_nodes
  []
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



627
628
629
# File 'lib/yarp/node.rb', line 627

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> BackReferenceReadNode



632
633
634
635
636
# File 'lib/yarp/node.rb', line 632

def copy(**params)
  BackReferenceReadNode.new(
    params.fetch(:location) { location },
  )
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



642
643
644
# File 'lib/yarp/node.rb', line 642

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



646
647
648
649
# File 'lib/yarp/node.rb', line 646

def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector.to_str
end