diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/journey/nfa/simulator.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/nfa/simulator.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/journey/nfa/simulator.rb b/actionpack/lib/action_dispatch/journey/nfa/simulator.rb index c2dfec3e21..5b40da6569 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/simulator.rb @@ -6,7 +6,7 @@ module ActionDispatch class MatchData # :nodoc: attr_reader :memos - def initialize memos + def initialize(memos) @memos = memos end end @@ -14,29 +14,29 @@ module ActionDispatch class Simulator # :nodoc: attr_reader :tt - def initialize transition_table + def initialize(transition_table) @tt = transition_table end - def simulate string - input = StringScanner.new string - state = tt.eclosure 0 + def simulate(string) + input = StringScanner.new(string) + state = tt.eclosure(0) until input.eos? sym = input.scan(%r([/.?]|[^/.?]+)) # FIXME: tt.eclosure is not needed for the GTG - state = tt.eclosure tt.move(state, sym) + state = tt.eclosure(tt.move(state, sym)) end acceptance_states = state.find_all { |s| - tt.accepting? tt.eclosure(s).sort.last + tt.accepting?(tt.eclosure(s).sort.last) } return if acceptance_states.empty? - memos = acceptance_states.map { |x| tt.memo x }.flatten.compact + memos = acceptance_states.map { |x| tt.memo(x) }.flatten.compact - MatchData.new memos + MatchData.new(memos) end alias :=~ :simulate |