Class: SyntaxTree::RegexpContent

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

Overview

RegexpContent represents the body of a regular expression.

/.+ #{pattern} .+/

In the example above, a RegexpContent node represents everything contained within the forward slashes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#child_nodes, #deconstruct, #deconstruct_keys, #format, #pretty_print, #to_json

Constructor Details

#initialize(beginning:, parts:, location:) ⇒ RegexpContent

Returns a new instance of RegexpContent.



8574
8575
8576
8577
8578
# File 'lib/syntax_tree/node.rb', line 8574

def initialize(beginning:, parts:, location:)
  @beginning = beginning
  @parts = parts
  @location = location
end

Instance Attribute Details

#beginningObject (readonly)

String

the opening of the regular expression



8565
8566
8567
# File 'lib/syntax_tree/node.rb', line 8565

def beginning
  @beginning
end

#locationObject (readonly)

Location

the location of this node



8572
8573
8574
# File 'lib/syntax_tree/node.rb', line 8572

def location
  @location
end

#partsObject (readonly)

Array[ StringDVar | StringEmbExpr | TStringContent ]

the parts of the

regular expression



8569
8570
8571
# File 'lib/syntax_tree/node.rb', line 8569

def parts
  @parts
end