void *regex_parser::parse_re(NFA* nfa, const char *re){ int ptr=0; bool tilde_re=false; NFA *non_anchored = *(nfa->get_epsilon()->begin()); NFA *anchored = *(++nfa->get_epsilon()->begin()); //check whether the text must match at the beginning of the regular expression if (re[ptr]==TILDE){ tilde_re=true; ptr++; } NFA *fa=parse_re(re,&ptr,false); fa->get_last()->accept(); if (!tilde_re){ non_anchored->add_epsilon(fa->get_first()); }else{ anchored->add_epsilon(fa->get_first()); } }