Class: Strling::Core::IRBackref
Overview
Represents a backreference in the IR.
Matches the same text as previously captured by a group.
Instance Attribute Summary collapse
-
#by_index ⇒ Integer?
The group index to reference.
-
#by_name ⇒ String?
The group name to reference.
Instance Method Summary collapse
-
#initialize(by_index: nil, by_name: nil) ⇒ IRBackref
constructor
A new instance of IRBackref.
- #to_dict ⇒ Object
Constructor Details
#initialize(by_index: nil, by_name: nil) ⇒ IRBackref
Returns a new instance of IRBackref.
302 303 304 305 |
# File 'lib/strling/core/ir.rb', line 302 def initialize(by_index: nil, by_name: nil) @by_index = by_index @by_name = by_name end |
Instance Attribute Details
#by_index ⇒ Integer?
Returns The group index to reference.
295 296 297 |
# File 'lib/strling/core/ir.rb', line 295 def by_index @by_index end |
#by_name ⇒ String?
Returns The group name to reference.
298 299 300 |
# File 'lib/strling/core/ir.rb', line 298 def by_name @by_name end |
Instance Method Details
#to_dict ⇒ Object
307 308 309 310 311 312 |
# File 'lib/strling/core/ir.rb', line 307 def to_dict data = { 'ir' => 'Backref' } data['byIndex'] = by_index unless by_index.nil? data['byName'] = by_name unless by_name.nil? data end |