Class: Resyma::Core::RegexpSelect
- Defined in:
- lib/resyma/core/automaton/regexp.rb
Instance Attribute Summary collapse
-
#regexp_list ⇒ Object
readonly
Returns the value of attribute regexp_list.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(regexp_list) ⇒ RegexpSelect
constructor
Select one regexp from a list of regexps.
- #inject(ab, start_state) ⇒ Object
Methods inherited from Regexp
Constructor Details
#initialize(regexp_list) ⇒ RegexpSelect
Select one regexp from a list of regexps
73 74 75 |
# File 'lib/resyma/core/automaton/regexp.rb', line 73 def initialize(regexp_list) @regexp_list = regexp_list end |
Instance Attribute Details
#regexp_list ⇒ Object (readonly)
Returns the value of attribute regexp_list.
77 78 79 |
# File 'lib/resyma/core/automaton/regexp.rb', line 77 def regexp_list @regexp_list end |
Instance Method Details
#==(other) ⇒ Object
79 80 81 |
# File 'lib/resyma/core/automaton/regexp.rb', line 79 def ==(other) other.is_a?(self.class) && other.regexp_list == @regexp_list end |
#inject(ab, start_state) ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/resyma/core/automaton/regexp.rb', line 83 def inject(ab, start_state) accept = ab.new_state! @regexp_list.each do |regexp| option_start = ab.new_state! ab.add_transition!(start_state, Epsilon, option_start) option_end = regexp.inject(ab, option_start) ab.add_transition!(option_end, Epsilon, accept) end accept end |