class RegularExpression::AST::Quantifier::Exact

Attributes

value[R]

Public Class Methods

new(value) click to toggle source
# File lib/regular_expression/ast.rb, line 298
def initialize(value)
  @value = value
end

Public Instance Methods

quantify(start, finish) { |states, states| ... } click to toggle source
# File lib/regular_expression/ast.rb, line 306
def quantify(start, finish)
  states = [start, *(value - 1).times.map { NFA::State.new }, finish]

  value.times do |index|
    yield states[index], states[index + 1]
  end
end
to_dot(parent) click to toggle source
# File lib/regular_expression/ast.rb, line 302
def to_dot(parent)
  parent.add_node(object_id, label: "{#{value}}", shape: "box")
end