Logo Search packages:      
Sourcecode: lttoolbox version File versions

int Compiler::matchTransduction ( list< string > const &  lp,
list< string > const &  rp,
int  state,
Transducer t 
) [private]

Construct symbol pairs by align left side of both parts and insert them into a transducer

Parameters:
lp left part of the transduction
rp right part of the transduction
state the state from wich insert the new transduction
t the transducer
Returns:
the last state of the inserted transduction

Definition at line 161 of file Compiler.C.

References alphabet, direction, Transducer::insertNewSingleTransduction(), and Transducer::insertSingleTransduction().

Referenced by insertEntryTokens().

{
  list<string>::const_iterator izqda, dcha, limizqda, limdcha;

  if(direction == COMPILER_RESTRICTION_LR_VAL)
  {
    izqda = pi.begin();
    dcha = pd.begin();
    limizqda = pi.end();
    limdcha = pd.end();
  }
  else
  {
    izqda = pd.begin();
    dcha = pi.begin();
    limizqda = pd.end();
    limdcha = pi.end();
  }
 

  if(pi.size() == 0 && pd.size() == 0)
  {
    estado = t.insertNewSingleTransduction(alphabet("", ""), estado);
  }
  else
  {
    while(true)
    {
      int etiqueta;

      if(izqda == limizqda && dcha == limdcha)
      {
        break;
      }
      else if(izqda == limizqda)
      {
        etiqueta = alphabet("", *dcha);
        dcha++;
      }
      else if(dcha == limdcha)
      {
        etiqueta = alphabet(*izqda, "");
        izqda++;
      }
      else
      {
        etiqueta = alphabet(*izqda, *dcha);
        izqda++;
        dcha++;
      }

      estado = t.insertSingleTransduction(etiqueta, estado);
    }
  }

  return estado;
}


Generated by  Doxygen 1.6.0   Back to index