Class: YARP::RegularExpressionNode

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

Overview

Represents a regular expression literal with no interpolation.

/foo/i
^^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opening_loc, content_loc, closing_loc, unescaped, flags, location) ⇒ RegularExpressionNode

def initialize: (opening_loc: Location, content_loc: Location, closing_loc: Location, unescaped: String, flags: Integer, location: Location) -> void



5054
5055
5056
5057
5058
5059
5060
5061
# File 'lib/yarp/node.rb', line 5054

def initialize(opening_loc, content_loc, closing_loc, unescaped, flags, location)
  @opening_loc = opening_loc
  @content_loc = content_loc
  @closing_loc = closing_loc
  @unescaped = unescaped
  @flags = flags
  @location = location
end

Instance Attribute Details

#closing_locObject (readonly)

attr_reader closing_loc: Location



5045
5046
5047
# File 'lib/yarp/node.rb', line 5045

def closing_loc
  @closing_loc
end

#content_locObject (readonly)

attr_reader content_loc: Location



5042
5043
5044
# File 'lib/yarp/node.rb', line 5042

def content_loc
  @content_loc
end

#flagsObject (readonly)

attr_reader flags: Integer



5051
5052
5053
# File 'lib/yarp/node.rb', line 5051

def flags
  @flags
end

#opening_locObject (readonly)

attr_reader opening_loc: Location



5039
5040
5041
# File 'lib/yarp/node.rb', line 5039

def opening_loc
  @opening_loc
end

#unescapedObject (readonly)

attr_reader unescaped: String



5048
5049
5050
# File 'lib/yarp/node.rb', line 5048

def unescaped
  @unescaped
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5064
5065
5066
# File 'lib/yarp/node.rb', line 5064

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

#child_nodesObject Also known as: deconstruct

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



5070
5071
5072
# File 'lib/yarp/node.rb', line 5070

def child_nodes
  []
end

#closingObject

def closing: () -> String



5093
5094
5095
# File 'lib/yarp/node.rb', line 5093

def closing
  closing_loc.slice
end

#contentObject

def content: () -> String



5088
5089
5090
# File 'lib/yarp/node.rb', line 5088

def content
  content_loc.slice
end

#deconstruct_keys(keys) ⇒ Object

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



5078
5079
5080
# File 'lib/yarp/node.rb', line 5078

def deconstruct_keys(keys)
  { opening_loc: opening_loc, content_loc: content_loc, closing_loc: closing_loc, unescaped: unescaped, flags: flags, location: location }
end

#openingObject

def opening: () -> String



5083
5084
5085
# File 'lib/yarp/node.rb', line 5083

def opening
  opening_loc.slice
end