Class: SyntaxTree::RegexpEnd
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::RegexpEnd
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
9026
9027
9028
9029
|
# File 'lib/syntax_tree/node.rb', line 9026
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the end of the regular expression
9024
9025
9026
|
# File 'lib/syntax_tree/node.rb', line 9024
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
9052
9053
9054
|
# File 'lib/syntax_tree/node.rb', line 9052
def ===(other)
other.is_a?(RegexpEnd) && value === other.value
end
|
#accept(visitor) ⇒ Object
9031
9032
9033
|
# File 'lib/syntax_tree/node.rb', line 9031
def accept(visitor)
visitor.visit_regexp_end(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
9035
9036
9037
|
# File 'lib/syntax_tree/node.rb', line 9035
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
9039
9040
9041
9042
9043
9044
|
# File 'lib/syntax_tree/node.rb', line 9039
def copy(value: nil, location: nil)
RegexpEnd.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
9048
9049
9050
|
# File 'lib/syntax_tree/node.rb', line 9048
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|