method
transition_table
v7.0.0 -
Show latest stable
-
0 notes -
Class: Builder
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
transition_table()
public
Hide source
# File actionpack/lib/action_dispatch/journey/gtg/builder.rb, line 19 def transition_table dtrans = TransitionTable.new marked = {}.compare_by_identity state_id = Hash.new { |h, k| h[k] = h.length }.compare_by_identity dstates = [firstpos(root)] until dstates.empty? s = dstates.shift next if marked[s] marked[s] = true # mark s s.group_by { |state| symbol(state) }.each do |sym, ps| u = ps.flat_map { |l| @followpos[l] }.uniq next if u.empty? from = state_id[s] if u.all? { |pos| pos == DUMMY_END_NODE } to = state_id[Object.new] dtrans[from, to] = sym dtrans.add_accepting(to) ps.each { |state| dtrans.add_memo(to, state.memo) } else to = state_id[u] dtrans[from, to] = sym if u.include?(DUMMY_END_NODE) ps.each do |state| if @followpos[state].include?(DUMMY_END_NODE) dtrans.add_memo(to, state.memo) end end dtrans.add_accepting(to) end end dstates << u end end dtrans end