Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

int Transducer::insertTransducer ( int const   source,
Transducer t,
int const   epsilon_tag = 0 

Insertion of a transducer in a given source state, unifying their final states using a optionally given epsilon tag

source the source state
t the transducer being inserted
epsilon_tag the epsilon tag
the new target state

Definition at line 121 of file Transducer.C.

References finals, initial, joinFinals(), newState(), and transitions.

Referenced by RegExpCompiler::Esp(), Compiler::insertEntryTokens(), and RegExpCompiler::Term().

  map<int, int> relacion;

  for(map<int, multimap<int, int> >::const_iterator it = t.transitions.begin(),
                                                    limit = t.transitions.end();
      it != limit; it++)
    relacion[it->first] = newState();

  for(map<int, multimap<int, int> >::const_iterator it = t.transitions.begin();
      it != t.transitions.end(); it++)
    for(multimap<int, int>::const_iterator it2 = it->second.begin(),
                                           limit2 = (it->second).end(); 
        it2 != limit2; it2++)
      transitions[relacion[it->first]].insert(pair<int, int>(it2->first, relacion[it2->second]));

  transitions[source].insert(pair<int, int>(epsilon_tag, 

  return relacion[*(t.finals.begin())];

Generated by  Doxygen 1.6.0   Back to index