Class: Strling::Core::Quant
Overview
Represents a quantifier (repetition operator).
Specifies how many times a pattern element should match (min to max times). Supports greedy, lazy, and possessive modes.
Instance Attribute Summary collapse
-
#child ⇒ Node
The child node being quantified.
-
#max ⇒ Integer, String
The maximum number of matches (“Inf” for unbounded).
-
#min ⇒ Integer
The minimum number of matches.
-
#mode ⇒ String
The quantifier mode: “Greedy”, “Lazy”, or “Possessive”.
Instance Method Summary collapse
-
#initialize(child, min, max, mode) ⇒ Quant
constructor
A new instance of Quant.
- #to_dict ⇒ Object
Constructor Details
#initialize(child, min, max, mode) ⇒ Quant
Returns a new instance of Quant.
328 329 330 331 332 333 |
# File 'lib/strling/core/nodes.rb', line 328 def initialize(child, min, max, mode) @child = child @min = min @max = max @mode = mode end |
Instance Attribute Details
#child ⇒ Node
Returns The child node being quantified.
313 314 315 |
# File 'lib/strling/core/nodes.rb', line 313 def child @child end |
#max ⇒ Integer, String
Returns The maximum number of matches (“Inf” for unbounded).
319 320 321 |
# File 'lib/strling/core/nodes.rb', line 319 def max @max end |
#min ⇒ Integer
Returns The minimum number of matches.
316 317 318 |
# File 'lib/strling/core/nodes.rb', line 316 def min @min end |
#mode ⇒ String
Returns The quantifier mode: “Greedy”, “Lazy”, or “Possessive”.
322 323 324 |
# File 'lib/strling/core/nodes.rb', line 322 def mode @mode end |
Instance Method Details
#to_dict ⇒ Object
335 336 337 338 339 340 341 342 343 |
# File 'lib/strling/core/nodes.rb', line 335 def to_dict { 'kind' => 'Quant', 'child' => child.to_dict, 'min' => min, 'max' => max, 'mode' => mode } end |