Class: SyntaxTree::RegexpEnd

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

RegexpEnd represents the end of a regular expression literal.

/.+/m

In the example above, the RegexpEnd event represents the /m at the end of the regular expression literal. You can also declare regular expression literals using %r, as in:

%r{.+}m

Instance Attribute Summary collapse

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ RegexpEnd

Returns a new instance of RegexpEnd.



7231
7232
7233
7234
# File 'lib/syntax_tree/node.rb', line 7231

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

String

the end of the regular expression



7229
7230
7231
# File 'lib/syntax_tree/node.rb', line 7229

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7236
7237
7238
# File 'lib/syntax_tree/node.rb', line 7236

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

#child_nodesObject Also known as: deconstruct



7240
7241
7242
# File 'lib/syntax_tree/node.rb', line 7240

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



7246
7247
7248
# File 'lib/syntax_tree/node.rb', line 7246

def deconstruct_keys(keys)
  { value: value, location: location }
end