method
memos
v8.1.1 -
Show latest stable
- Class:
ActionDispatch::Journey::GTG::Simulator
memos(string)public
No documentation available.
# File actionpack/lib/action_dispatch/journey/gtg/simulator.rb, line 31
def memos(string)
state = INITIAL_STATE
pos = 0
eos = string.bytesize
while pos < eos
start_index = pos
pos += 1
if (token = STATIC_TOKENS[string.getbyte(start_index)])
state = tt.move(state, string, token, start_index, false)
else
while pos < eos && STATIC_TOKENS[string.getbyte(pos)].nil?
pos += 1
end
token = string.byteslice(start_index, pos - start_index)
state = tt.move(state, string, token, start_index, true)
end
end
acceptance_states = []
states_count = state.size
i = 0
while i < states_count
if state[i + 1].nil?
s = state[i]
if tt.accepting?(s)
acceptance_states.concat(tt.memo(s))
end
end
i += 2
end
acceptance_states.empty? ? yield : acceptance_states
end