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

void Transducer::linkStates ( int const   source,
int const   target,
int const   tag 
)

Link two existing states by a transduction

Parameters:
source the source state
target the target state
tag the tag of the transduction

Definition at line 153 of file Transducer.C.

References transitions.

Referenced by RegExpCompiler::Cola(), Compiler::insertEntryTokens(), joinFinals(), oneOrMore(), and optional().

{

  if(transitions.find(source) != transitions.end() &&
     transitions.find(destino) != transitions.end())
  {
    // new code
    pair<multimap<int, int>::iterator, multimap<int, int>::iterator> range;
    range = transitions[source].equal_range(etiqueta);
    for(;range.first != range.second; range.first++)
    {
      if(range.first->first == etiqueta && range.first->second == destino)
      {
        return;
      }
    }
    // end of new code
    transitions[source].insert(pair<int, int>(etiqueta, destino));
  }
  else
  {
    cerr << "Error: Trying to link nonexistent states (" << source;
    cerr << ", " << destino << ", " << etiqueta << ")" << endl;
    exit(EXIT_FAILURE);
  }
}


Generated by  Doxygen 1.6.0   Back to index