Method: Kleene::NFA#matches_at_offset

Defined in:
lib/kleene/nfa.rb

#matches_at_offset(input, input_start_offset) ⇒ Object

Returns an array of matches found in the input string, each of which begins at the offset input_start_offset



133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/kleene/nfa.rb', line 133

def matches_at_offset(input, input_start_offset)
  reset_current_states

  matches = []
  (input_start_offset...input.size).each do |offset|
    token = input[offset]
    handle_token!(token)
    if accept?
      matches << MatchRef.new(input, input_start_offset..offset)
    end
  end
  matches
end