Class: Resyma::Core::RegexpConcat

Inherits:
Regexp
  • Object
show all
Defined in:
lib/resyma/core/automaton/regexp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Regexp

#to_automaton

Constructor Details

#initialize(regexp_list) ⇒ RegexpConcat

Concatentate a list of regexps

Parameters:

  • regexp_list (Array<Regexp>)

    A list of instances of Regexp



48
49
50
# File 'lib/resyma/core/automaton/regexp.rb', line 48

def initialize(regexp_list)
  @regexp_list = regexp_list
end

Instance Attribute Details

#regexp_listObject (readonly)

Returns the value of attribute regexp_list.



52
53
54
# File 'lib/resyma/core/automaton/regexp.rb', line 52

def regexp_list
  @regexp_list
end

Instance Method Details

#==(other) ⇒ Object



54
55
56
# File 'lib/resyma/core/automaton/regexp.rb', line 54

def ==(other)
  other.is_a?(self.class) && other.regexp_list == @regexp_list
end

#inject(ab, start_state) ⇒ Object



58
59
60
61
62
63
64
# File 'lib/resyma/core/automaton/regexp.rb', line 58

def inject(ab, start_state)
  current_start = start_state
  @regexp_list.each do |regexp|
    current_start = regexp.inject(ab, current_start)
  end
  current_start
end