Class: SyntaxTree::RegexpBeg
Overview
RegexpBeg represents the start of a regular expression literal.
/.+/
In the example above, RegexpBeg represents the first / token. Regular expression literals can also be declared using the %r syntax, as in:
%r{.+}
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the beginning 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:) ⇒ RegexpBeg
constructor
A new instance of RegexpBeg.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ RegexpBeg
Returns a new instance of RegexpBeg.
9072 9073 9074 9075 |
# File 'lib/syntax_tree/node.rb', line 9072 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the regular expression
9070 9071 9072 |
# File 'lib/syntax_tree/node.rb', line 9070 def value @value end |
Instance Method Details
#===(other) ⇒ Object
9098 9099 9100 |
# File 'lib/syntax_tree/node.rb', line 9098 def ===(other) other.is_a?(RegexpBeg) && value === other.value end |
#accept(visitor) ⇒ Object
9077 9078 9079 |
# File 'lib/syntax_tree/node.rb', line 9077 def accept(visitor) visitor.visit_regexp_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
9081 9082 9083 |
# File 'lib/syntax_tree/node.rb', line 9081 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
9085 9086 9087 9088 9089 9090 |
# File 'lib/syntax_tree/node.rb', line 9085 def copy(value: nil, location: nil) RegexpBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
9094 9095 9096 |
# File 'lib/syntax_tree/node.rb', line 9094 def deconstruct_keys(_keys) { value: value, location: location } end |