protected <S, E, T1, T2, NFA extends Nfa<S>> void create(Production<E, T1> production, NFA nfa, S state, Iterable<E> followerElements, FollowerFunction<E> followerFunc, Function<E, T2> tokenFunc, NfaFactory<NFA, S, ? super T2> factory, Map<E, S> ele2state) { List<S> sfollower = Lists.newArrayList(); for (E follower : followerElements) { S fs = ele2state.get(follower); if (fs == null) { fs = factory.createState(nfa, tokenFunc.apply(follower)); ele2state.put(follower, fs); create(production, nfa, fs, followerFunc.getFollowers(follower), followerFunc, tokenFunc, factory, ele2state); } sfollower.add(fs); } factory.setFollowers(nfa, state, sfollower); }
protected <S, E, T1, T2, P extends Nfa<S>> void create(Production<E, T1> production, P nfa, S state, Iterable<E> followerElements, FollowerFunction<E> followerFunc, Function<E, T2> tokenFunc, NfaFactory<P, S, ? super T2> factory, Map<E, S> ele2state) { List<S> sfollower = Lists.newArrayList(); for (E follower : followerElements) { S fs = ele2state.get(follower); if (fs == null) { fs = factory.createState(nfa, tokenFunc.apply(follower)); ele2state.put(follower, fs); create(production, nfa, fs, followerFunc.getFollowers(follower), followerFunc, tokenFunc, factory, ele2state); } sfollower.add(fs); } factory.setFollowers(nfa, state, sfollower); }
s = fact.createPop(pda, tokens.apply(c)); stops.put(c, s); create(cfg, pda, s, c, ff.getFollowers(c), false, ff, tokens, fact, states, stops, callers); s = fact.createState(pda, tokens.apply(fol)); states.put(fol, s); create(cfg, pda, s, fol, ff.getFollowers(fol), true, ff, tokens, fact, states, stops, callers);
s = fact.createPop(pda, tokens.apply(c)); stops.put(c, s); create(cfg, pda, s, c, ff.getFollowers(c), ff, tokens, fact, states, stops, callers); s = fact.createState(pda, tokens.apply(fol)); states.put(fol, s); create(cfg, pda, s, fol, ff.getFollowers(fol), ff, tokens, fact, states, stops, callers);