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
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ RegexpBeg
constructor
A new instance of RegexpBeg.
Methods inherited from Node
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ RegexpBeg
Returns a new instance of RegexpBeg.
7411 7412 7413 7414 |
# File 'lib/syntax_tree/node.rb', line 7411 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the regular expression
7409 7410 7411 |
# File 'lib/syntax_tree/node.rb', line 7409 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
7416 7417 7418 |
# File 'lib/syntax_tree/node.rb', line 7416 def accept(visitor) visitor.visit_regexp_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7420 7421 7422 |
# File 'lib/syntax_tree/node.rb', line 7420 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
7426 7427 7428 |
# File 'lib/syntax_tree/node.rb', line 7426 def deconstruct_keys(_keys) { value: value, location: location } end |