Class: SyntaxTree::RegexpEnd
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
-
#value ⇒ Object
readonly
- String
-
the end of the regular expression.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ RegexpEnd
constructor
A new instance of RegexpEnd.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ RegexpEnd
Returns a new instance of RegexpEnd.
9117 9118 9119 9120 |
# File 'lib/syntax_tree/node.rb', line 9117 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the end of the regular expression
9115 9116 9117 |
# File 'lib/syntax_tree/node.rb', line 9115 def value @value end |
Instance Method Details
#===(other) ⇒ Object
9143 9144 9145 |
# File 'lib/syntax_tree/node.rb', line 9143 def ===(other) other.is_a?(RegexpEnd) && value === other.value end |
#accept(visitor) ⇒ Object
9122 9123 9124 |
# File 'lib/syntax_tree/node.rb', line 9122 def accept(visitor) visitor.visit_regexp_end(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
9126 9127 9128 |
# File 'lib/syntax_tree/node.rb', line 9126 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
9130 9131 9132 9133 9134 9135 |
# File 'lib/syntax_tree/node.rb', line 9130 def copy(value: nil, location: nil) RegexpEnd.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
9139 9140 9141 |
# File 'lib/syntax_tree/node.rb', line 9139 def deconstruct_keys(_keys) { value: value, location: location } end |