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.createPush(pda, tokens.apply(fol)); states.put(fol, s); create(cfg, pda, s, e, ff.getStarts(e), true, 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);
public <S, E, T1, T2, NFA extends Nfa<S>> NFA create(Production<E, T1> production, FollowerFunction<E> ff, Function<E, T2> tokenFunc, NfaFactory<NFA, S, ? super T2> factory, T2 start, T2 stop) { Map<E, S> states = Maps.newHashMap(); NFA nfa = factory.create(start, stop); states.put(null, nfa.getStop()); create(production, nfa, nfa.getStart(), ff.getStarts(production.getRoot()), ff, tokenFunc, factory, states); return nfa; }
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.createPush(pda, tokens.apply(fol)); states.put(fol, s); create(cfg, pda, s, e, ff.getStarts(e), 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);
public <S, E, T1, T2, P extends Nfa<S>> P create(Production<E, T1> production, FollowerFunction<E> ff, Function<E, T2> tokenFunc, NfaFactory<P, S, ? super T2> factory, T2 start, T2 stop) { Map<E, S> states = Maps.newLinkedHashMap(); P nfa = factory.create(start, stop); states.put(null, nfa.getStop()); create(production, nfa, nfa.getStart(), ff.getStarts(production.getRoot()), ff, tokenFunc, factory, states); return nfa; }
public <S, P, E, T1, T2, D extends Pda<S, P>> D create(Cfg<E, T1> cfg, FollowerFunction<E> ff, Function<E, T2> element2token, PdaFactory<D, S, P, ? super T2> fact) { D pda = fact.create(null, null); Map<E, S> states = Maps.newLinkedHashMap(); Map<E, S> stops = Maps.newLinkedHashMap(); Multimap<E, E> callers = new CfgUtil().getCallers(cfg); create(cfg, pda, pda.getStart(), cfg.getRoot(), ff.getStarts(cfg.getRoot()), ff, element2token, fact, states, stops, callers); return pda; }
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); }
public <S, P, E, T1, T2, D extends Pda<S, P>> D create(Cfg<E, T1> cfg, FollowerFunction<E> ff, Function<E, T2> element2token, PdaFactory<D, S, P, ? super T2> fact) { D pda = fact.create(null, null); Map<E, S> states = Maps.newHashMap(); Map<E, S> stops = Maps.newHashMap(); Multimap<E, E> callers = new CfgUtil().getCallers(cfg); create(cfg, pda, pda.getStart(), cfg.getRoot(), ff.getStarts(cfg.getRoot()), true, ff, element2token, fact, states, stops, callers); return pda; }