Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set <State*> move(set<State*>& states, char c) {
- set<State*> ret;
- stack <State*> states_stack;
- for (State *state : states)
- states_stack.push(state);
- while (!states_stack.empty()) {
- State* curr_state = states_stack.top();
- states_stack.pop();
- map<char, vector<State*> >& transitions = curr_state->get_transitions();
- map<char, vector<State*> >::iterator start = transitions.find(c);
- if(start != transitions.end())
- for (State * s : start->second)
- ret.insert(s->get_epsilon_closure().begin(), s->get_epsilon_closure().end());
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement