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

#construct_keys, #format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ RegexpEnd

Returns a new instance of RegexpEnd.



7323
7324
7325
7326
# File 'lib/syntax_tree/node.rb', line 7323

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

Instance Attribute Details

#valueObject (readonly)

String

the end of the regular expression



7321
7322
7323
# File 'lib/syntax_tree/node.rb', line 7321

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7328
7329
7330
# File 'lib/syntax_tree/node.rb', line 7328

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

#child_nodesObject Also known as: deconstruct



7332
7333
7334
# File 'lib/syntax_tree/node.rb', line 7332

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



7338
7339
7340
# File 'lib/syntax_tree/node.rb', line 7338

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